ListView doesn't scroll to end, when keyboard using

久未见 提交于 2019-12-04 03:48:18

You can try to add this line of code after you set selection to your list:

listView.smoothScrollToPosition(listView.getCount());

Resulting code should look like this:

listView.postDelayed(new Runnable() {
        @Override
        public void run() {
            listView.setSelection(listView.getCount());
            listView.smoothScrollToPosition(listView.getCount());
        }
    }, 100);

Try this insead of your code:

listView.setTranscriptMode(ListView.TRANSCRIPT_MODE_ALWAYS_SCROLL);

(or set it by XML layout).

Set android:windowSoftInputMode in manifest for the activity to adjustPan|adjustResize.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!