0
我想將RecyclerView滾動到某個位置,並使用LinearLayoutManager.scrollToPositionWithOffset()滾動,但它不起作用。任何人都可以幫助我嗎?Android滾動到在Recylerview中的位置不起作用
我想將RecyclerView滾動到某個位置,並使用LinearLayoutManager.scrollToPositionWithOffset()滾動,但它不起作用。任何人都可以幫助我嗎?Android滾動到在Recylerview中的位置不起作用
RecyclerView rv = findViewById(R.id.recycler_view);
LinearLayoutManager layoutManager = new LinearLayoutManager(this);
rv.setLayoutLayoutManager(layoutManager);
layoutManager.smoothScrollToPosition(position);
使用與特定的RecyclerView一起使用的LayoutManager可以實現將RecyclerView滾動到某個項目位置。 PLZ參考上面的代碼段
我願買電子健康參考。謝謝 –
的可能的複製[RecyclerView LinearLayoutManager.scrollToPositionWithOffset沒有作用](http://stackoverflow.com/questions/31265476/recyclerview-linearlayoutmanager-scrolltopositionwithoffset-dose-not-work) – CAMOBAP