简体   繁体   中英

android set font size of tab

i have an android app with a tab activity. the font size is to large, because the last 1 - 2 letters will be cut. how can i set my font size of these tabs?

i add my tabs to the tab activity like this:

TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
        tabLayout.addTab(tabLayout.newTab().setText("Tab 1");

TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
        tabLayout.addTab(tabLayout.newTab().setText("Tab 2");

TabLayout tabLayout = (TabLayout) findViewById(R.id.tab_layout);
        tabLayout.addTab(tabLayout.newTab().setText("Tab 3");


        tabLayout.setTabGravity(TabLayout.GRAVITY_FILL);

Try this style:

<style name="MineCustomTabText" parent="TextAppearance.Design.Tab">
    <item name="android:textSize">14sp</item>
</style>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM