android - Making listview move to last item position -
am trying make listview move last item when new items added view. textview achieve doing
layout layout = myview.getlayout(); if(layout != null){ int scrolldelta = layout.getlinebottom(myview.getlinecount() - 1) - myview.getscrolly() - myview.getheight(); if(scrolldelta > 0) myview.scrollby(0, scrolldelta); }
but listview adapter, can't seem figure out method call. adapter setup
myview = (listview) findviewbyid(r.id.myview_list); myadapter = new arrayadapter<>(this, r.layout.list, entries); myview.setadapter(myadapter);
use smoothscrolltoposition(int position)
. scroll listview passed in element on screen. if don't know number of items, use listview.smoothscrolltoposition(adapter.getcount());
Comments
Post a Comment