WarriorYu

Results 9 comments of WarriorYu

再次进入,能不能把上次选择的图片带进来,显示已选中状态,能不能给加这个方法呢?或者有没有可扩展的接口,用户来实现

app:apTabShouldExpand="false" 这个属性不管是true还是false,都一样,Tab文字稍微多点就显示不全

大家可以根据图片里这个流程来扩展,展开讨论: ![触摸事件传递机制](https://user-images.githubusercontent.com/16720902/63562092-e59fe500-c58e-11e9-99ec-af600e25520c.png)

答: 如果想平滑滚动到RecyclerView的某个Item,可以通过RecyclerView.smoothScrollToPosition(position);我们一般是当列表往上滑动一段距离后,显示一个「返回顶部」的按钮,点击返回到顶部,这个方法很完美。但是有一个特殊的场景:当点击按钮后,不是滑动到顶部,而是滑动到还没有显示出来的某个Item(比如要求滑动到position=10,当前在position=1),这时候滑动出来的position=10的Item的底部贴在在屏幕的底部,而不是Item的顶部贴在屏幕的顶部。如果RecyclerView是垂直的,想解决这个问题,需要自定义一个LinearLayoutManager,通过RecyclerView.setLayoutManager(new LinearLayoutManagerWithSmoothScroller(context));替换掉原来的LinearLayoutManager。看代码: public class LinearLayoutManagerWithSmoothScroller extends LinearLayoutManager { public LinearLayoutManagerWithSmoothScroller(Context context) { super(context, RecyclerView.VERTICAL, false); } public LinearLayoutManagerWithSmoothScroller(Context context, int orientation, boolean reverseLayout) { super(context, orientation, reverseLayout); } @Override...