2017-07-08 27 views

回答

1

似乎你正在使用非常古老的技术来创建Navigation Drawer。它的大约4年的代码,似乎perfect关于old version

仅供参考,以前这种UI是使用DrawerLayoutListView完成的。但是现在,android本身通过引入一个名为Navigation Drawer的新概念,正式推出滑动面板菜单,其中我们结合DrawerLayoutNavigationView来实现所需的输出。

如何使汉堡菜单完全可见?

SOLUTION:

  1. 使用AppCompatActivity代替Activity和使用AppCompat主题,以达到所需的输出。使用NavigationView代替ListView

这里是NavigationView一个例子:

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

    <!-- Your contents --> 

    <android.support.design.widget.NavigationView 
     android:id="@+id/navigation" 
     android:layout_width="wrap_content" 
     android:layout_height="match_parent" 
     android:layout_gravity="start" 
     app:menu="@menu/my_navigation_items" /> 
</android.support.v4.widget.DrawerLayout> 

这里是一个很好的教程:Android Sliding Menu using Navigation Drawer

希望这将有助于〜这里