如何覆盖在福尔摩斯行动起来吧pressed状态颜色? [英] how to override pressed state color in sherlock action bar?

查看:228
本文介绍了如何覆盖在福尔摩斯行动起来吧pressed状态颜色?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我实现了大侦探动作条在我的应用程序有深绿色行动起来吧..
#008000。当我preSS的动作栏按钮原来的IC蓝色(默认)颜色...如何原来绿色的,当我preSS动作栏按钮?

在的themes.xml我使用这一点。

 

 <资源>
<样式名称=Theme.Styled父=Theme.Sherlock.Light>
    <项目名称=actionBarStyle> @风格/ Widget.Styled.ActionBar< /项目>
    <项目名称=机器人:actionBarStyle> @风格/ Widget.Styled.ActionBar< /项目>
 <项目名称=actionBarItemBackground> @绘制/选择器和LT; /项目>
< /风格>
<样式名称=Widget.Styled.ActionBar父=Widget.Sherlock.Light.ActionBar.Solid.Inverse>
    <项目名称=背景>#008000< /项目>
    <项目名称=机器人:背景>#008000< /项目>    <项目名称=backgroundSplit> @绘制/ bg_striped_split< /项目>
    <项目名称=机器人:backgroundSplit> @绘制/ bg_striped_split< /项目>
< /风格>

在绘制selector.xml

 <项目的android:STATE_ pressed =真正的机器人:可绘制=@绘制/ pressed/>
<项目的android:state_focused =真正的机器人:可绘制=@绘制/聚焦/>
<项目机器人:可绘制=@机器人:彩色/透明/>


在绘制pressed.xml

 <形状的xmlns:机器人=htt​​p://schemas.android.com/apk/res/android机器人:形状=矩形>         [固体机器人:颜色=#690>< /固体>     < /形状>


解决方案

在你的风格添加此

 <项目名称=机器人:actionBarItemBackground> @绘制/选择器和LT; /项目>

I implemented sherlock actionbar in my app which has dark green action bar .. #008000. when i press the action bar button it turns out ics blue (default) color...how to turns out green when i press action bar button?.

IN themes.xml i am using this.

       <resources>
<style name="Theme.Styled" parent="Theme.Sherlock.Light">
    <item name="actionBarStyle">@style/Widget.Styled.ActionBar</item>
    <item name="android:actionBarStyle">@style/Widget.Styled.ActionBar</item>
 <item name="actionBarItemBackground">@drawable/selector</item>
</style>
<style name="Widget.Styled.ActionBar" parent="Widget.Sherlock.Light.ActionBar.Solid.Inverse">
    <item name="background">#008000</item>
    <item name="android:background">#008000</item>

    <item name="backgroundSplit">@drawable/bg_striped_split</item>
    <item name="android:backgroundSplit">@drawable/bg_striped_split</item>


</style>

in drawable selector.xml

<item android:state_pressed="true" android:drawable="@drawable/pressed" />
<item android:state_focused="true" android:drawable="@drawable/focused" />
<item android:drawable="@android:color/transparent" />


in drawable pressed.xml

     <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">

         <solid android:color="#690"></solid>

     </shape>

解决方案

add this in your style

       <item name="android:actionBarItemBackground">@drawable/selector</item>

这篇关于如何覆盖在福尔摩斯行动起来吧pressed状态颜色?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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