ScrollView 滚动到最后/前/上/下
16lz
2021-01-26
ScrollView.fullScroll(int direction):
Handles scrolling in response to a "home/end" shortcut press. This method will scroll the view to the top or bottom and give the focus to the topmost/bottommost component in the new visible area. If no component is a good candidate for focus, this scrollview reclaims the focus.
方向: View.Focus_Up,Focus_Down,Focus_Left,Focus_Right,水平滚动的将使用Focus_Left,Focus_Right,垂直的使用View.Focus_Up,Focus_Down.
对ScrollView.fullScroll()的调用,应该这样
postDelayed(new Runnable() { @Override public void run() { view.fullScroll(ScrollView.FOCUS_RIGHT); } },100L);
如果直接调用可能会无效,所以让其延迟下。android中经常使用消息队列来同步.
更多相关文章
- Android(安卓)ApiDemos示例解析(101):Views->Auto Complete->3.
- OkHttpClient加载图片给DisposableObserver,CompositeDisposable
- Android程序开始的等待动画或LOGO
- Android异步通信机制(一)
- Android(安卓)获取View中的组件
- 【Android】 PopupWindow使用小结
- 是否应该开启WebView硬件加速?
- android启动activity的详细过程
- Android(安卓)MP4视频录制(思路篇,无DEMO)