Skip to content Skip to sidebar Skip to footer

How To Make Navigation Drawer Without Actionbar

I am trying to implement navigation drawer without ActionBar. There is a small layout and inside it there is a button. When the button is clicked then the navigation drawer will o

Solution 1:

To hide actionbar, simply do this:

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    getSupportActionBar().hide(); 
}

Solution 2:

Define your xml like this and you are done

<android.support.v4.widget.DrawerLayoutxmlns:android="http://schemas.android.com/apk/res/android"android:id="@+id/drawer_layout"android:layout_width="match_parent"android:layout_height="match_parent"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="match_parent"><LinearLayoutandroid:layout_width="match_parent"android:layout_height="100dp" // staticheightforvieworkeepitdimen.xmlandroid:background="#21ef70"android:gravity="bottom"android:orientation="horizontal"><Buttonandroid:layout_width="wrap_content"android:layout_height="wrap_content"android:text="Click"android:id="@+id/button2" /></LinearLayout></LinearLayout><!-- Listview to display navigation menu --><ListViewandroid:id="@+id/list_slidermenu"android:layout_width="240dp"android:layout_height="match_parent"android:layout_gravity="start"android:layout_marginTop="100dp" // samemarginasoflayoutandroid:choiceMode="singleChoice"android:dividerHeight="1dp" /></android.support.v4.widget.DrawerLayout>

Post a Comment for "How To Make Navigation Drawer Without Actionbar"