I'm flollowing next tutorial:
I want do that similar design:
I know i need use Two toolbars.
values/themes.xml
<resources>
<style name="Theme.MiThema" parent="Theme.AppCompat.Light">
<!-- Here we setting appcompat’s actionBarStyle -->
<!--<item name="actionBarStyle">@style/MyActionBarStyle</item>-->
<!-- ...and here we setting appcompat’s color theming attrs -->
<item name="colorPrimary">@color/primary</item>
<item name="colorPrimaryDark">@color/primary_dark</item>
<!-- colorAccent is used as the default value for colorControlActivated
which is used to tint widgets -->
<item name="colorAccent">@color/accent</item>
</style>
</resources>
class.java
import android.os.Bundle;
import android.support.v7.app.ActionBarActivity;
import android.widget.Toolbar;
public class RegistrarInciTraActivity extends ActionBarActivity
{
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.registrar_inci_traf_layout);
//ocultamos ActionBar
getSupportActionBar().hide();
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
}
}
layout
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:orientation="horizontal">
<!-- The toolbar -->
<android.support.v7.widget.Toolbar
android:id="@+id/toolbar"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:minHeight="?attr/actionBarSize"
android:background="?attr/colorPrimary" />
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/my_drawer_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!-- drawer view -->
<LinearLayout
android:layout_width="304dp"
android:layout_height="match_parent"
android:layout_gravity="left|start">
<!-- drawer content -->
</LinearLayout>
<!-- normal content view -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!-- The rest of content view -->
</LinearLayout>
</android.support.v4.widget.DrawerLayout>
</LinearLayout>
Tha code report one error on "setSupportActionBar(toolbar);":
(first problem) ¿What is the problem about that? (SOLVED)
(Second problem)
On my layout appear
"?attr/actionBarSize" and "?attr/colorPrimary"
Where do I have to declare those attributes?
(Third problem)
When I do two toolbars only appear once of them and I want one inside the other to display content.
What I do have to display both toolbars?
Thanks