简体   繁体   中英

Drag Listview Item on Top

How to drag array item when some code execute?

<ListView
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_alignParentLeft="true"
        android:id="@+id/listview"
        android:layout_alignParentStart="true"
        android:layout_alignParentTop="true" />

For Drag Listview Item on Top means 0th position:

getListView().setSelection(0);

For a smooth scroll:

getListView().smoothScrollToPosition(0);

Use this property. Hope this will help...

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