0

How can i change color text and background color title of Popup Menu?

When i want change another item in popup menu i use something like this :

 <style name="itemTextStyle.customTheme" parent="@android:style/TextAppearance.Widget.IconMenu.Item">
    <item name="android:textColor">@color/green</item>
    <item name="android:textSize">10dp</item>
</style>

I would like to change only this tittle : ScreenShot

asus9e
  • 23
  • 6
  • 3
    Possible duplicate of [How to style PopupMenu?](http://stackoverflow.com/questions/12636101/how-to-style-popupmenu) – Mohammad Tauqir Mar 24 '17 at 12:04
  • I tried this solution and doesn't work – asus9e Mar 24 '17 at 13:52
  • what is your app style. or do you have any style for the container activity. let me know. – Mohammad Tauqir Mar 24 '17 at 14:00
  • I know how change header tittle color from java code, but i use context menu in many activity so i duplicate code... – asus9e Mar 28 '17 at 07:51

2 Answers2

0

By getting the object of title, you can customize it

TextView alertTitle = (TextView) dialog.getWindow().getDecorView().findViewById(alertTitleId);
alertTitle.setTextColor(color);
Pratik Sinha
  • 234
  • 1
  • 14
0

ADD POPUPMENU TO Apptheme:

 <style name="AppTheme" parent="android:Theme.Light">
        <item name="android:popupMenuStyle">@style/PopupMenu</item>
    </style>
    <style name="PopupMenu" parent="@android:style/Widget.PopupMenu">
        <item name="android:popupBackground">@android:color/white</item>
    </style>

manifest.xml:

     <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
    .............
    </application>
qwerty421
  • 63
  • 5