选项卡标题未在材料设计库中完全显示

时间:2023-01-13 23:58:44

I am following this tutorial and I changed the code of setupTabIcons in CustomViewIconTextTabsActivity:

我正在学习本教程,并在CustomViewIconTextTabsActivity中更改了setupTabIcons的代码:

private void setupTabIcons() {  
    TextView tabOne = (TextView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
    tabOne.setText("PROPOSAL");
    tabOne.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_tab_favourite, 0, 0);
    tabLayout.getTabAt(0).setCustomView(tabOne);

    TextView tabTwo = (TextView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
    tabTwo.setText("MY JOBS");
    tabTwo.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_tab_call, 0, 0);
    tabLayout.getTabAt(1).setCustomView(tabTwo);

    TextView tabThree = (TextView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
    tabThree.setText("MESSAGE");
    tabThree.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_tab_contacts, 0, 0);
    tabLayout.getTabAt(2).setCustomView(tabThree);

    TextView tabFour = (TextView) LayoutInflater.from(this).inflate(R.layout.custom_tab, null);
    tabFour.setText("PROFILE");
    tabFour.setCompoundDrawablesWithIntrinsicBounds(0, R.drawable.ic_tab_contacts, 0, 0);
    tabLayout.getTabAt(3).setCustomView(tabFour);
}

PROPOSAL is not showing completely..it is showing PROPOSA at first tab

PROPOSAL没有完全显示..在第一个标签显示PROPOSA

I try to increase and decrease text size of textview... how show complete text in tab?

我尝试增加和减少textview的文本大小...如何在标签中显示完整的文字?

1 个解决方案

#1


0  

Open activity_custom_view_icon_text_tabs.xml and change the tabMode of TabLayout to scrollable:

打开activity_custom_view_icon_text_tabs.xml并将TabLayout的tabMode更改为可滚动:

<android.support.design.widget.TabLayout
    android:id="@+id/tabs"
    android:layout_width="match_parent"
    android:layout_height="@dimen/custom_tab_layout_height"
    app:tabMode="scrollable"
    app:tabGravity="fill"/>

#1


0  

Open activity_custom_view_icon_text_tabs.xml and change the tabMode of TabLayout to scrollable:

打开activity_custom_view_icon_text_tabs.xml并将TabLayout的tabMode更改为可滚动:

<android.support.design.widget.TabLayout
    android:id="@+id/tabs"
    android:layout_width="match_parent"
    android:layout_height="@dimen/custom_tab_layout_height"
    app:tabMode="scrollable"
    app:tabGravity="fill"/>