Reputation: 127
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?
Upvotes: 0
Views: 5554
Reputation: 781
You can use something like the below in the manifest file
<activity
android:name=".ActivityName"
android:theme="@style/styleName"/>
Upvotes: 0
Reputation: 781
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>
Upvotes: 5