更改Android的ShareActionProvider背景颜色,当pressed颜色、背景、Android、ShareActionProvider

2023-09-12 22:00:20 作者:一口价不卖!

我的应用程序的主要颜色是某种黄色。操作栏中的ShareActionProvider有一种微调的,当pressed显示默认的全息蓝色。

要做出的动作栏样式一致的,我需要有分享按钮的背景去黄时pressed。如何做到这一点?

我使用的是标准动作条(不兼容或福尔摩斯)

这是一个不工作:

shareMenuItem.getActionView().setBackgroundResource(R.drawable.spinner_background_ab_webcamhd_custom_ab); 如何修复一个Eclipse Android的安装

和没有关于造型的ShareActionProvider上使问题得到任何答案:(

解决方案

我说这我的主题,它的工作:

 <项目名称=listPopupWindowStyle> @风格/ Widget.AppCompat.Light.ListPopupWindow< /项目>
 

所以,如果你想定制你需要创建自己的风格的颜色

My app's primary color is some kind of yellow. The ShareActionProvider in the action bar has a kind of spinner that when pressed shows the default holo blue color.

To make the action bar style coherent, I need to have the share button background go yellow when pressed. How to achieve that?

I am using the standard action bar (no compatibility or sherlock)

That one does not work:

shareMenuItem.getActionView().setBackgroundResource(R.drawable.spinner_background_ab_webcamhd_custom_ab);

And none of the questions on SO about styling the ShareActionProvider got any answer :(

解决方案

I added this to my theme and it worked:

<item name="listPopupWindowStyle">@style/Widget.AppCompat.Light.ListPopupWindow</item>

So if you want to customize the colors you need to create your own style