卸下操作栏主页图标pressed效果图标、效果、操作、主页

2023-09-12 02:38:44 作者:眼泪何必固执

首先,对应用程序中的几句话:最低级别是16,我用的是DrawerLayout(带指示灯),并改变了我的动作条的背景

First, a few words about the app : minimum level is 16, I use a DrawerLayout (with the indicator) and have changed the background of my ActionBar.

在上的主页按钮点击打开抽屉,同时存在的图像和抽屉指示灯,蓝色,pressed效果,我想删除。我试图在样式透明设置 selectableItemBackground ,几乎无处不在我能想到的,但似乎没有任何改变。不要任何人有一个解决方案吗?

When clicking on the home button to open the drawer, there is a blue pressed effect on both the image and the drawer indicator, that I'd like to remove. I tried setting selectableItemBackground in the styles to transparent, nearly everywhere I could think of, but that doesn't seem to change anything. Do anyone have a solution ?

下面是此效果的图像,我想删除:

Here is the image of this effect I'd like to remove :

下面是styles.xml一部分,我使用的动作条:

Here is the styles.xml part for the ActionBar I'm using :

<style name="ActionBar.Solid.Bnp" parent="@android:style/Widget.Holo.Light.ActionBar.Solid.Inverse">
    <item name="android:background">@drawable/action_bar_green</item>
    <item name="android:titleTextStyle">@style/ActionBar.Title</item>
    <item name="android:actionBarItemBackground">@null</item>
</style>

和最后用于背景的绘制。

and finally the drawable used for background.

推荐答案

selectableItemBackground 被关闭,但你需要使用 actionBarItemBackground 属性来代替。

selectableItemBackground is close, but you need to use the actionBarItemBackground attribute instead.

例如:

<style name="Your.Theme" parent="@android:style/Theme.Holo.Light.DarkActionBar">
    <item name="android:actionBarItemBackground">@null</item>
</style>

您应该记住,该系统使用此属性的 ActivityChooserView 过,这是什么 ShareActionProvider ActionProvider.onCreateActionView 的回报。

You should keep in mind that the system uses this attribute in the ActivityChooserView too, which is what the ShareActionProvider returns in ActionProvider.onCreateActionView.

要突出这一切,这里有结果,当您使用 @android:彩色/ holo_red_light 来代替:

To highlight all this, here are the results when you use @android:color/holo_red_light instead: