如何更新滾動位置。現在每當我點擊物品時,位置都會更新。我想每次滾動時更新位置。我想要做的是有一個文本視圖,它將在滾動項目時得到更新。滾動時更新recyclerview的位置(android)
recyclerView.addOnItemTouchListener(new GalleryAdapter.RecyclerTouchListener(this, recyclerView, new GalleryAdapter.ClickListener()
{
@Override
public void onClick(View view, int position) {
Intent intent = new Intent(mainActivityCarasoul.this, PDFViewerActivity.class);
intent.putExtra(PDFViewerActivity.TAG, books.get(position));
intent.putExtra("from", "mainActivityCarasoul");
startActivity(intent);
}
@Override
public void onLongClick(View view, int position) {
}
}));
recyclerView.addOnScrollListener(new CenterScrollListener());
recyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
// title.setText(books.get(position).getName());
}
});
您onBindView持有人你是什麼意思更新的位置?你需要描述你想要做得更清楚的事情。 –
我更新了問題 –
退房http://stackoverflow.com/questions/24989218/get-visible-items-in-recyclerview –