简体   繁体   中英

How to disable a ListView scrolling?

I have a list view that always scroll to begining when i adding new itens. I tried to use: lv.setSelection(position) , lv.ScrollTo(x,y) , change the onScrollListner of the ListView, but i don't have sucess.

Anyone can help me?

add scrollview to the xml file that your listview will bind with,

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android
android:layout_width="fill_parent"
android:layout_height="wrap_content"> 
<TextView
    android:id="@+id/title"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center_horizontal"
    android:text:"test"
    android:textColor="#000" />
</ScrollView>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM