I am making a list of tags, and I put them in a RecyclerView.
Here is my code :
var tagsRv : RecyclerView? = null
tagsRv = binding.tagsRv
tagsRv?.adapter = tagsAdapter
val layoutManager : LinearLayoutManager = LinearLayoutManager(this, LinearLayoutManager.HORIZONTAL, false)
tagsRv?.layoutManager = layoutManager
if (menu.tags.isNotEmpty)
tagsAdapter.setTags(menu.tags)
It does work, but I would like to make this horizontal list go back to the line when it reach the phone border.
Does someone know a magical property that can be add to my var layoutManager, that will do the job ?
Or do I have to make an algorythm to do this by myself ?
If I use bad terms, please give me the right words so I can search by myself.
Thanks in advance.
EDIT : Here is the part of the layout file corresponding to my RecyclerView :
<android.support.design.widget.CoordinatorLayout
android:id="@+id/coordinator_layout_infos"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.discodery.android.discoderyapp.infos.InfosActivity">
<android.support.v4.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white"
app:layout_behavior="@string/appbar_scrolling_view_behavior">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<!-- More stuff -->
<android.support.v7.widget.RecyclerView
android:id="@+id/tags_rv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginEnd="15dp"
android:layout_marginLeft="15dp"
android:layout_marginRight="15dp"
android:layout_marginStart="15dp"
android:orientation="vertical" />
<!-- More stuff -->
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</android.support.design.widget.CoordinatorLayout>
And here is a picture :
The tags are in blue, and they overtake my phone border, and I want them to continue back to the line instead.
This is the expected output :
Sorry for being hard to understand, I can hardly express my problem.