Skip to content Skip to sidebar Skip to footer

No App Bar And Drawer In Other Activity Except Main

main activity public class MainActivity extends AppCompatActivity { @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceSta

Solution 1:

You don't have action bar in another activity, because you do not set it in another activity. This part of code should be added to each onCreate method:

    toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    initNavigationDrawer();

Because by default, you removed ActionBar from any activity by using:

<item name="windowActionBar">false</item>
<item name="windowNoTitle">true</item>

in your application code.

P.S. Btw, this part of code:

<android.support.v7.widget.Toolbar
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        app:popupTheme="@style/AppTheme.PopupOverlay" />

Should be also added to each activity layout file, if you wish to use toolbar at that activities.

P.S.S. You should read Adding the App Bar and Creating a Navigation Drawer tutorials from google.

Post a Comment for "No App Bar And Drawer In Other Activity Except Main"