我想换ListView到RecyclerView.我想使用onScroll的的OnScrollListener在RecyclerView确定用户滚动到列表的末尾.
如何知道用户是否滚动到列表末尾以便我可以从REST服务获取新数据?
android listview onscrolllistener material-design android-recyclerview
我想自动滚动一个水平滚动视图,当它到达最后一个imageview时,在linearlayout中包含很多imageview,第一个出现,依此类推
我发现这个代码 符合我的需要但是当我添加了自动滚动时,圆形功能将无法工作:当到达最后一个imageview时,第一个不会出现
这是我的代码:
slider = (RelativeLayout)findViewById(R.id.slider);
RelativeLayout container = (RelativeLayout) findViewById(R.id.slider);
scrollView = new PSInfiniteScrollView(this,new PSSize(120,120));
for (int i = 0; i < 10; i++) {
MyCloneableView img = new MyCloneableView(this);
img.setId(i + 20);
img.setImageResource(R.drawable.ic_launcher);
img.setScaleType(ImageView.ScaleType.FIT_XY);
img.setBackgroundColor(c[i]);
img.setTag(c[i]);
scrollView.addItem(img);
}
container.addView(scrollView);
Thread t = new Thread(new Runnable() {
@Override
public void run() {
doLoop();
}
});
t.start();
Run Code Online (Sandbox Code Playgroud)
这里的doLoop方法:
private void doLoop(){
do {
scrollView.scrollBy(2, 0);
try {
Thread.sleep(50);
} catch (InterruptedException e) {
e.printStackTrace();
}
scrollView.scrollBy(2, 0);
try …Run Code Online (Sandbox Code Playgroud)