A
A
afna2016-05-22 15:26:38
Java
afna, 2016-05-22 15:26:38

How to set popupMenu style programmatically?

Good day to all!
There is a constructor

PopupMenu(Context context, View anchor, int gravity, int popupStyleAttr, int popupStyleRes)
//Constructor a create a new popup menu with a specific style.

my style
<style name="PopupMenuStyle"
        parent="@style/Widget.AppCompat.Light.PopupMenu">        
        <item name="android:textColorPrimary">@color/white</item>
        <item name="android:dropDownVerticalOffset">-54dp</item>
        <item name="android:textColor">@color/white</item>
        <item name="android:popupBackground">@drawable/shadow_popuo_menu</item>
    </style>

How to apply this style?
Tried like this:
PopupMenu popup = new PopupMenu(this, textView, Gravity.NO_GRAVITY, 0, R.style.PopupMenuStyle);

So the style is not applied.

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question