Ich verwende ein Tablayout in meiner Android-App, die benutzerdefinierte Registerkarten aufbläht und sie mit Symbolen einrichten. Der Text einer der Registerkarten wird wegen Platzmangels abgeschnitten. Ich muss den Text wirklich klein machen um ihn vollständig anzuzeigen. So wird mein Tablayout eingerichtet.Text wird in Registerkarte Tablayout abgeschnitten
<android.support.design.widget.TabLayout
android:id="@+id/tabs"
app:layout_scrollFlags="scroll|enterAlways"
android:layout_width="match_parent"
android:layout_height="@dimen/custom_tab_layout_height"
app:tabMode="fixed"
app:tabGravity="fill" />
Die benutzerdefinierte Registerkarte Layout sieht folgendermaßen aus:
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/custom_text"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="?attr/selectableItemBackground"
android:gravity="center"
android:textSize="8dip"
android:textColor="#ffffff"
android:singleLine="true"/>
und hier ist der Code, wo ich ein Setup der Text und die Symbole für die Registerkarten:
TextView tabOne = (TextView)LayoutInflater.From(this).Inflate(Resource.Layout.custom_tab, null);
tabOne.Text = "Home";
tabOne.SetCompoundDrawablesWithIntrinsicBounds(0, Resource.Drawable.homewhite, 0, 0);
tabLayout.GetTabAt(0).SetCustomView(tabOne);
TextView tab2 = (TextView)LayoutInflater.From(this).Inflate(Resource.Layout.custom_tab, null);
tab2.Text = "Inbox";
tab2.SetCompoundDrawablesWithIntrinsicBounds(0, Resource.Drawable.messageWhite, 0, 0);
tabLayout.GetTabAt(1).SetCustomView(tab2);
TextView tab3 = (TextView)LayoutInflater.From(this).Inflate(Resource.Layout.custom_tab, null);
tab3.SetCompoundDrawablesWithIntrinsicBounds(0, Resource.Drawable.upload_icon, 0, 0);
tabLayout.GetTabAt(2).SetCustomView(tab3);
TextView tab4 = (TextView)LayoutInflater.From(this).Inflate(Resource.Layout.custom_tab, null);
tab4.Text = "Notification";
tab4.SetCompoundDrawablesWithIntrinsicBounds(0, Resource.Drawable.notifWhite, 0, 0);
tabLayout.GetTabAt(3).SetCustomView(tab4);
TextView tab5 = (TextView)LayoutInflater.From(this).Inflate(Resource.Layout.custom_tab, null);
tab5.Text = "Profile";
tab5.SetCompoundDrawablesWithIntrinsicBounds(0, Resource.Drawable.profWhite, 0, 0);
tabLayout.GetTabAt(4).SetCustomView(tab5);
Wenn ich den Text groß machen sieht das tablayout so aus
Wie kann ich den vollständigen Text anzeigen lassen? Wenn ich das Tablayout scrollbar mache, bewegt es sich nach rechts und links, während ich auf die Tabs klicke. Jede Hilfe wird geschätzt.