[英]ListView not scrollable
My ListView
does not receive onScroll events in case it is short and does not fill the whole screen, which is strange, because I have set fill_parent
as height. 我的
ListView
不会接收onScroll事件,以防它很短并且不能填满整个屏幕,这很奇怪,因为我已将fill_parent
设置为height。 My layout: 我的布局:
<?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>
You may find this answer useful:- 您可能会发现此答案有用:
Making TextView scrollable on Android 使TextView在Android上可滚动
Thats what helped me there: 那就是帮助我的地方:
<ScrollView
android:id="@+id/SCROLLER_ID"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:scrollbars="vertical"
android:fillViewport="true">
<TextView
android:id="@+id/TEXT_STATUS_ID"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1.0"/>
</ScrollView>
Mainly you wrap your TextView in a ScrollView. 主要是将TextView包装在ScrollView中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.