更改Android的ShareActionProvider背景颜色,当pressed [英] Change Android ShareActionProvider background color when pressed

查看:99
本文介绍了更改Android的ShareActionProvider背景颜色,当pressed的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

这是一个不工作:

<$p$p><$c$c>shareMenuItem.getActionView().setBackgroundResource(R.drawable.spinner_background_ab_webcamhd_custom_ab);

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

解决方案

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

 &LT;项目名称=listPopupWindowStyle&GT; @风格/ Widget.AppCompat.Light.ListPopupWindow&LT; /项目&GT;
 

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

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

这篇关于更改Android的ShareActionProvider背景颜色,当pressed的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆