我正在开发应用程序,我需要导航抽屉。我使用谷歌的代码来开发导航抽屉
<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" >
<!-- Framelayout to display Fragments -->
<FrameLayout
android:id="@+id/frame_container"
android:layout_width="match_parent"
android:layout_height="match_parent" />
<!-- Listview to display slider menu -->
<ListView
android:id="@+id/list_slidermenu"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:layout_gravity="start"
android:background="#6495ED"
android:choiceMode="singleChoice"
android:divider="@color/list_divider"
android:dividerHeight="1dp"
android:listSelector="#fff" />
</android.support.v4.widget.DrawerLayout>
通过这个我得到一个导航抽屉,但我想把一个imageview放在列表视图上方。我用谷歌搜索但我没有办法实现
答案 0 :(得分:0)
我们可以添加一个HeaderView列表,userImage会像这样在listView之上 ViewGroup header =(ViewGroup)inflater.inflate(R.layout.headerview,mDrawerList,false);
mDrawerList.addHeaderView(header, null, false);