How to scroll to the bottom of ListView programmatically?

前端 未结 3 1481
借酒劲吻你
借酒劲吻你 2020-12-04 16:40

After calling notifydatasetchanged(); I want to scroll to the bottom of list so that user see the last record in the Listview.

(I am writing Chat modul

3条回答
  •  误落风尘
    2020-12-04 17:05

    I know its very late to answer but may be it will help someone. Using android:transcriptMode="alwaysScroll" will force the listview to scroll to bottom (as here we have used android:stackFromBottom="true") even if you'll try to scroll top which usually required most of the time. So instead of android:transcriptMode="alwaysScroll you can use android:transcriptMode="normal which will behave similar to the requirement of chat app and will not force the list of scroll always if the user want to see the content at the top.

提交回复
热议问题