Drawerlayout与Activity Layout中的ListView冲突。但只有ListView工作正常,只有DrawerLayout工作正常。问题是如果他们一起工作
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:id="@+id/diary_layout"
android:background="@drawable/activebg">
<ListView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
android:layout_marginTop="20dp"
android:listSelector="@android:color/transparent"
android:id="@+id/diary_list">
</ListView>
<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">
<ListView android:id="@+id/navList"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="#111"/>
</android.support.v4.widget.DrawerLayout>
</RelativeLayout>
在这种情况下,当我有抽屉布局listview不起作用 (不是点击,不是滚动)。如果删除
<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">
<ListView android:id="@+id/navList"
android:layout_width="240dp"
android:layout_height="match_parent"
android:layout_gravity="start"
android:choiceMode="singleChoice"
android:divider="@android:color/transparent"
android:dividerHeight="0dp"
android:background="#111"/>
</android.support.v4.widget.DrawerLayout>
这个块listview工作正常。有谁可以帮助我?
答案 0 :(得分:0)
Difference is that, in my example i use ListView(not ScrollView), there is solved this problem
Android ScrollView not scrolling in Activity with Drawer Layout