设置菜单背景是不透明

编程入门 行业动态 更新时间:2024-10-09 05:14:40
本文介绍了设置菜单背景是不透明的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想设置菜单窗格的背景是不透明的。很多但是搜索和尝试的事情,我几乎可以得到它的工作通过设置'panelFullBackground,之后,我得到失去了菜单面板的顶部边缘以及它的阴影效果的不想要的结果。我猜测,仅通过设置颜色,我失去了与panelFullBackground相关的其他样式。

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'.

我设置我的应用程序有一个自定义样式。风格继承Theme.Light。 在我的风格,我的设置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:

在stylex.xml:

In stylex.xml:

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

在colors.xml

In colors.xml

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

我已经使用panelColorForeground试图|背景,但他们没有达到我想要的

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

值得一提的,我试图用setMenuBackground做法在其他地方建议无济于事。

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

在此先感谢。

推荐答案

可以从 @Color 值设置为 @drawable 像下面这为我工作:

You can value from @color to @drawable like below which worked for me:

<style name="MyTheme" parent="@android:style/Theme.Holo.Light"> <!-- Menu Style --> <item name="android:panelBackground">@drawable/blue_background</item> </style>

更多推荐

设置菜单背景是不透明

本文发布于:2023-11-05 02:51:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1559708.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:不透明   菜单   背景

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!