Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/230.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 如何在抽屉布局中显示ListView?我的应用程序无法显示它_Android_Listview_Drawerlayout - Fatal编程技术网

Android 如何在抽屉布局中显示ListView?我的应用程序无法显示它

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

在我的应用程序中,我在抽屉布局中创建了一个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/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>