LoginSignup
5
5

More than 5 years have passed since last update.

ListView⇒RecyclerViewの置き換えメモ

Last updated at Posted at 2015-06-08

ListViewをRecyclerViewに置き換えるときのメモです。

だいたいこんな風に置き換えればよさそう。

ListView RecyclerView
ListView.setSelectionFromTop(pos, offset) LinearLayoutManager.scrollToPositionWithOffset(pos, offset)
ListView.getFirstVisiblePositionなど LinearLayoutManager.findFirstVisibleItemPositionなど
setFastScrollEnabled 自作するしかなさそう(参考)

onItemClickとかonItemLongClickは実装方法が色々あるのでググればいいと思う。
自分は RecyclerView.Adapter#onCreateViewHolder 内で inflate した view に直接貼った。

5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5