I can't set text with multi-line in TabLayout in my application.
How can I set text with multi-line in TabLayout?
I want to remove "..." in TabLayout text.
I can't set text with multi-line in TabLayout in my application.
How can I set text with multi-line in TabLayout?
I want to remove "..." in TabLayout text.
See below link that will help you to set multiline in Tab of Tab Layout
Remove line break in TabLayout
or
set your custom text view like bellow in tab_item layout
<TextView
android:id="@+id/tvTabTitle"
style="@style/wrapParentRegularFont"
android:maxLines="2"
android:textSize="@dimen/_10sdp" />
<android.support.design.widget.TabLayout
android:id="@+id/tlMyJobCart"
style="@style/widthMatchParent"
android:layout_marginLeft="@dimen/_20sdp"
android:layout_marginRight="@dimen/_20sdp"
app:tabGravity="fill"
app:tabIndicatorColor="@color/color_radical_red"
app:tabMode="fixed" />
And then set your text view to Tab layout like
private TabLayout tlMyTabLayout;
tlMyTabLayout = (TabLayout) view.findViewById(R.id.tlMyTabLayout);
tlMyTabLayout.addTab(tlMyTabLayout.newTab().setCustomView(R.layout.tab_item), true);
You can set a customView (a textView, preferably) by doing this:
TabLayout tabLayout = (TabLayout) findViewById(R.id.tabLayout);
TextView tv = new TextView(this);
tv.setLines(2)
tv.setMaxLines(2); //set max lines to 2
tv.setText("your multi-line text is here");
tabLayout.addTab(tabLayout.newTab().setCustomView(tv));
In case, you wish to set customView to already added tabs, you can get the tab and set the customView (TextView) to it:
tabLayout.getTabAt(0).setCustomView(tv); //postion 0, 1, 2...