导航抽屉如何在列表视图上方添加图像视图
navigation drawer how to add image view above list view
我正在开发需要导航抽屉的应用程序。我使用了 google 的代码来开发导航抽屉
<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>
通过这个我得到了一个导航抽屉,但是我想把一个图像视图放在列表视图上面。我 googled 它但是我没有办法
我们可以添加一个 HeaderView 到列表中,这样 userImage 就会出现在 listView 之上
ViewGroup header = (ViewGroup) inflater.inflate(R.layout.headerview, mDrawerList,false);
mDrawerList.addHeaderView(header, null, false);
我正在开发需要导航抽屉的应用程序。我使用了 google 的代码来开发导航抽屉
<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>
通过这个我得到了一个导航抽屉,但是我想把一个图像视图放在列表视图上面。我 googled 它但是我没有办法
我们可以添加一个 HeaderView 到列表中,这样 userImage 就会出现在 listView 之上 ViewGroup header = (ViewGroup) inflater.inflate(R.layout.headerview, mDrawerList,false);
mDrawerList.addHeaderView(header, null, false);