I need to do this UI same this image as below: Currently I don't know how to create it. I need some examples or some existing library or some keywords to refer to, so anyone who has created a layout like this can help me suggest them.
Asked
Active
Viewed 39 times
0
-
use recycler view in android using horizontal scroll https://stackoverflow.com/questions/37733221/android-horizontal-recyclerview-scroll-direction – RogerK Feb 25 '23 at 13:00
-
Are you using XML Views or Jetpack Compose? – radda Feb 25 '23 at 21:20
1 Answers
0
I don't really understand what you mean. However, to make an image slider like that, try using RecyclerView in horizontal orientation. For example:
XML :
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/horizontal_only"
tools:orientation="horizontal"
tools:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:layout_width="match_parent"
tools:listitem="@layout/your_item_list"
android:layout_height="match_parent" />
Activity :
rv_horizontal = findViewById(R.id.horizontal_only)
rv_horizontal.apply {
layoutManager = LinearLayoutManager(this,LinearLayoutManager.HORIZONTAL,false)
setHasFixedSize(true)
yourAdapter.notifyDataSetChanged()
adapter = yourAdapter
}
Don't forget to set your adapter to list on RecyclerView.

Chishiya
- 31
- 4