Q:

text wrapping in two lines - recyclerview

i am designing the app having expected UI like this 

i am using RecyclerView with
StaggeredGridLayoutManager manager=new StaggeredGridLayoutManager(3,1);
        recyclerView.setLayoutManager(manager);

and this is the row xml file
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="@dimen/padding_8dp"
    android:layout_marginLeft="@dimen/padding_4dp"
    android:layout_marginRight="@dimen/padding_4dp"
   >

    <com.skcsllp.mutterfly.views.widgets.MfTextView
        android:id="@+id/tagName"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        style="@style/textview"
        android:layout_gravity="center_horizontal"
        android:gravity="center"
        android:textSize="@dimen/text_18"

        android:background="@drawable/selector_tags"
        android:textColor="@color/tags_text_color"

        />

</LinearLayout>

using this much i am getting the output as 

i don't want tags to go into second line. i am aware about the fact that i have used the span count as 3 and so getting 3 tags in one line but is there any way to avoid the text wrapping in two lines? 

A:

Instead of RecyclerView i would suggest you to use AndroidTagView
need to add dependency 
dependencies {
   compile 'co.lujun:androidtagview:1.0.3'
}

in your main xml, instead of RecyclerView
<co.lujun.androidtagview.TagContainerLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="0dp"
android:padding="10dp"
app:container_enable_drag="false"
app:horizontal_interval="10dp"
app:vertical_interval="10dp"
app:tag_clickable="true"
app:tag_theme="pure_teal" />

and in your activity/fragment
TagContainerLayout mTagContainerLayout = (TagContainerLayout) findViewById(R.id.tagcontainerLayout);
mTagContainerLayout.setTags(List<String> tags);

you will get output something like below, for more you can refer that library, they have given nice example project also.

other usefull libraries are listed below :
https://github.com/loopeer/MultiTextTagView
https://github.com/klinker41/android-chips
https://github.com/ApmeM/android-flowlayout
https://github.com/blazsolar/FlowLayout

