本章讲解解决scrollerView 或者NestedScrollerView 结合 listView 、 recyclerview 自动滑动到底部的问题
很简单,只需要重写
@Override
protected int computeScrollDeltaToGetChildRectOnScreen(Rect rect) {
return 0;
}
}
即可
新建类集成scrollerview 或者NestedScrollerview
package cn.iaapp.app.sixman.view;
import android.content.Context;
import android.graphics.Rect;
import android.util.AttributeSet;
import android.widget.ScrollView;
/**
* Created by 梁 on 2018/5/30.
*/
public class CustomerScrollerView extends ScrollView {
public CustomerScrollerView(Context context) {
super(context);
}
public CustomerScrollerView(Context context, AttributeSet attrs) {
super(context, attrs);
}
public CustomerScrollerView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
@Override
protected int computeScrollDeltaToGetChildRectOnScreen(Rect rect) {
return 0;
}
}
在布局中直接使用即可