2015-06-21 102 views
0

我想實現導航抽屜沒有ActionBar如何使導航抽屜沒有操作欄

enter image description here

有一個小的佈局,它裏面有一個按鈕。 點擊按鈕後,導航抽屜會打開。導航抽屜將在按鈕下方。 我如何在android中實現這個?

+1

可能重複:// stackoverflow.com/questions/30961326/navigation-drawer-without-actionbar-android) –

回答

0

定義你這樣的XML和你做

<android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:id="@+id/drawer_layout" 
android:layout_width="match_parent" 
android:layout_height="match_parent"> 

<LinearLayout 
    android:layout_width="match_parent" 
    android:layout_height="match_parent"> 
    <LinearLayout 
     android:layout_width="match_parent" 
     android:layout_height="100dp" // static height for view or keep it dimen.xml 
     android:background="#21ef70" 
     android:gravity="bottom" 
     android:orientation="horizontal"> 

     <Button 
      android:layout_width="wrap_content" 
      android:layout_height="wrap_content" 
      android:text="Click" 
      android:id="@+id/button2" /> 
    </LinearLayout> 
</LinearLayout> 

<!-- Listview to display navigation menu --> 
<ListView 
    android:id="@+id/list_slidermenu" 
    android:layout_width="240dp" 
    android:layout_height="match_parent" 
    android:layout_gravity="start" 
    android:layout_marginTop="100dp" // same margin as of layout 
    android:choiceMode="singleChoice" 
    android:dividerHeight="1dp" /> 
</android.support.v4.widget.DrawerLayout> 
+0

如果你想要它在綠色佈局下,只需填充到列表和透明背景。 –

+0

@StephaneMathis嘿我已經從頂部給列表視圖保證金? –

+0

看到這個鏈接http://stackoverflow.com/questions/30961326/navigation-drawer-without-actionbar-android/30961388?noredirect=1#comment49955090_30961388 –

0

要隱藏動作條,簡單地做到這一點:

@Override 
public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    getSupportActionBar().hide(); 
} 
[抽屜式導航無動作條,機器人(HTTP的