[这个问题过去可能至少被问过十二遍。看到过以前的回复,但似乎仍然无法正常工作
<?xml version="1.0" encoding="utf-8"?>
<ListView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/colors_list"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
我确实有一个不希望使用的解决方案,因为有人告诉我不需要使用NestedScrollView
,因为ListView
本身是可滚动的。但是,如果单独使用ListView
,我似乎无法滚动。为什么?
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/layout_background_color">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="?attr/actionBarSize"
android:orientation="vertical">
<ListView
android:id="@+id/colors_list"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>