我的ListView
没有收到onScroll事件,如果它很短并且不填满整个屏幕,这很奇怪,因为我已经设置了fill_parent
作为高度。 我的布局:ListView不滚动
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/bg_login_screen3"
android:orientation="vertical" >
<CheckBox
android:id="@+id/overview_allcars_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:text="@string/all_cars"
android:textSize="14sp" />
<LinearLayout
android:id="@+id/list_root"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/android:list"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:cacheColorHint="#00000000"
android:fadingEdge="horizontal"
android:scrollingCache="true" />
</LinearLayout>
</LinearLayout>
也许你的顶级linearLayout的高度应该是fill_parent,而不是match_parent .. – Daler
我认为fill_parent和match_parent是等价的。他们的行为一样。 – slezadav