0

I have created options using customized popup menu.
Now, I want to set the text size of menu items. I am getting default text size this time.
How can I achieve this? I don't want to use popup window.
Is it possible to achive this using popup menu only?

Vivek Warde
  • 1,936
  • 8
  • 47
  • 77
Anushka Agarwal
  • 127
  • 1
  • 3
  • 20

2 Answers2

5

I had the same problem. You can change the text size and color by adding this code to styles.xml and use it in manifest file. For me it worked.

 <style name="AppTheme" parent="AppBaseTheme">
    <item name="android:popupMenuStyle">@style/PopupMenu</item>
    <item name="android:textAppearanceLargePopupMenu">           @style/myPopupMenuTextAppearanceLarge</item>
    <item name="android:textAppearanceSmallPopupMenu">            @style/myPopupMenuTextAppearanceSmall</item>

    <!-- All customizations that are NOT specific to a particular API-level can go here. -->
</style>

<style name="PopupMenu" parent="@android:style/Widget.PopupMenu">
    <item name="android:popupBackground">@android:color/white</item>
    <item name="android:textColor">#FF01F0</item>
    <item name="android:textSize">12sp</item>
</style>


<style name="myPopupMenuTextAppearanceSmall" parent="@android:style/TextAppearance.DeviceDefault.Widget.PopupMenu.Small">
<item name="android:textColor">#545656</item>
<item name="android:textSize">15sp</item>
</style>
<style name="myPopupMenuTextAppearanceLarge" parent="@android:style/TextAppearance.DeviceDefault.Widget.PopupMenu.Large">
<item name="android:textColor">#545656</item>
<item name="android:textSize">25sp</item>
</style>
Ravitheja
  • 761
  • 1
  • 8
  • 24
0

You can use something like the below in the manifest file

 <activity 
  android:name=".ActivityName"
  android:theme="@style/styleName"/>
Ravitheja
  • 761
  • 1
  • 8
  • 24