How resize the Action Bar Menu Text Size in Androi

2019-04-09 05:57发布

问题:

This question already has an answer here:

  • How to change size of title's text on Action Bar? 5 answers

I am developing the android application. have one doubt regarding reduce the text size for action bar menu item. this my code.

<style name="MyActionBar.MenuTextStyle" parent="android:style/TextAppearance.Holo.Widget.ActionBar.Menu">
    <item name="android:textColor">#888888</item> <!-- 
    <item name="android:textStyle">bold</item> -->
    <item name="android:textSize">10dip</item>
    <item name="android:textAppearance">@android:style/TextAppearance.Medium</item>
</style>

Thanks in advance..

回答1:

Instead of dip try with sp

Check this Answer for better understanding.

  • Why should we use sp for font sizes in Android

check the following code :

<style name="MyActionBar.MenuTextStyle" parent="android:style/TextAppearance.Holo.Widget.ActionBar.Menu">
    <item name="android:textColor">#888888</item> <!-- 
    <item name="android:textStyle">bold</item> -->
    <item name="android:textSize">20sp</item>
    <item name="android:textAppearance">@android:style/TextAppearance.Medium</item>
</style>

Code adopted from this link. Changing text Size of menu item in android