android ScrollView自动滑到顶部

来源:互联网 发布:借贷宝刷脸认证软件 编辑:程序博客网 时间:2024/06/05 02:42
scrollview 自动定位到顶部
利用获取焦点的方式定位到最顶部的组件或layout

rl_layout = (RelativeLayout) rootView.findViewById(R.id.rl_layout);// scrollview的子组件
rl_layout.setFocusable(true);
rl_layout.setFocusableInTouchMode(true);
rl_layout.requestFocus();
scrollview自动定位到顶部
0 0
原创粉丝点击