Android 如何在抽屉布局中显示ListView?我的应用程序无法显示它
在我的应用程序中,我在抽屉布局中创建了一个ImageView和一个ListView,但ListView无论如何都无法显示。 代码:整个项目正在进行中 ListView xml文件是Android 如何在抽屉布局中显示ListView?我的应用程序无法显示它,android,listview,drawerlayout,Android,Listview,Drawerlayout,在我的应用程序中,我在抽屉布局中创建了一个ImageView和一个ListView,但ListView无论如何都无法显示。 代码:整个项目正在进行中 ListView xml文件是 <?xml version="1.0" encoding="utf-8"?><com.zhy.android.percent.support.PercentLinearLayout xmlns:android="http://schemas.android.com/apk/res/andro
<?xml version="1.0" encoding="utf-8"?><com.zhy.android.percent.support.PercentLinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/settinglayout"
android:layout_gravity="start"
android:orientation="vertical">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_heightPercent="30%"
android:src="@mipmap/ic_launcher"/>
<ListView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/choosecity"/>
</com.zhy.android.percent.support.PercentLinearLayout>
activity_main.xml文件为
<?xml version="1.0" encoding="utf-8"?>
<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">
<!--主界面-->
<include layout="@layout/main"/>
<!--侧边栏-设置菜单-->
<include layout="@layout/setting"/>
</android.support.v4.widget.DrawerLayout>
只能显示ImageView而不能显示ListView您是否在尝试制作类似导航抽屉的东西?
<?xml version="1.0" encoding="utf-8"?>
<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">
<!--主界面-->
<include layout="@layout/main"/>
<!--侧边栏-设置菜单-->
<include layout="@layout/setting"/>
</android.support.v4.widget.DrawerLayout>