Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How resize the Action Bar Menu Text Size in Android [duplicate]

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..

like image 313
parthi Avatar asked Aug 13 '14 05:08

parthi


People also ask

How do I change text size on toolbar?

setTextSize(18); actionbar. setDisplayOptions(ActionBar. DISPLAY_SHOW_CUSTOM); actionbar. setCustomView(textview);

What is default size of action bar in Android?

We can see that we are able to fetch the ActionBar height, which is equal to 147 Pixels.


1 Answers

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

like image 113
SilentKiller Avatar answered Oct 30 '22 14:10

SilentKiller