Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RecyclerView 自动滚动问题:RecyclerView 嵌套 RecyclerView,结果内部的RecyclerView会自动的滑动至顶部 #3

Open
wang12 opened this issue Apr 17, 2018 · 1 comment

Comments

@wang12
Copy link
Owner

wang12 commented Apr 17, 2018

  1. ScrollView或者RecyclerView1 嵌套RecyclerView2 ,
    进入页面自动跳转到recyclerView2上面页面会自动滚动

  2. 貌似是RecyclerView 自动获得了焦点

@wang12
Copy link
Owner Author

wang12 commented Apr 17, 2018

解决办法:

  1. 内部Recyclerview去除焦点,父布局里获得焦点。
recyclerview.setFocusableInTouchMode(false);
recyclerview.requestFocus();
  1. 在代码里面 让处于ScrollView或者RecyclerView1 顶端的某个控件获得焦点即可
    比如顶部的一个textview
tv_goodsName.setFocusableInTouchMode(true);  
tv_goodsName.requestFocus(); 
  1. 内部的Recyclerview加
android:overScrollMode="never"
  1. 父布局覆盖子VIew获取焦点:
android:descendantFocusability="blocksDescendants"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant