Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
378 views
in Technique[技术] by (71.8m points)

android - Setting the menu background to be opaque

I'm trying to set the background of the menu pane to be opaque. After a lot of searching and trying out things I can almost get it working by setting 'panelFullBackground', however, I get the unwanted result of losing the top edge of the menu pane along with its shadow effect. I'm guessing that by just setting the color I'm losing additional styles associated with 'panelFullBackground'.

I've set my application to have a custom style. The style inherits from Theme.Light. In my style I'm setting 'panelFullBackground' to a custom color as follows:

In stylex.xml:

<item name="android:panelFullBackground">@color/custom_theme_color</item>

In colors.xml

   <color name="custom_theme_color">#ff00ffff</color>

I've tried using panelColorForeground|Background but they do not achieve what I want.

It should be mentioned that I tried to use the setMenuBackground approach suggested elsewhere to no avail.

Thanks in advance.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

You can change the background of android menu options. It will look only in the default manner. If you want to change the look and feel of them, consider building a custom view for menu.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...