/thread-2581971-1-1.html
原帖来自ligux~~~~傻子啊傻子
如上次教程一样,准备工作是java环境以及反编译工具,还有你从自己ROM里提取出来的framework-res.apk。
反编译之后定位到value/styles.xml
1、查找IconMenu,找到下面的代码:
</style>
<style name="TextAppearance.Widget.IconMenu.Item" parent="@style/TextAppearance.Small">
<item name="textColor">?textColorPrimaryInverse</item>
</style>
可以看到他的color定义,为textColorPrimaryInverse,于是我们继续查找这个textColorPrimaryInverse,在页首发现,他的颜色定义到了
<item name="textColorPrimaryInverse">@color/primary_text_light</item>
就是res/color目录下primary_text_light.xml,找到,打开一看,果然是你现在一直想改掉的X色。
2、开始修改,这里有一个最简单的方法,如下所示
</style>
<style name="TextAppearance.Widget.IconMenu.Item" parent="@style/TextAppearance.Small">
<item name="textColor">?textColorPrimaryInverse</item>
</style>
直接将?textColorPrimaryInverse这一串修改为你想要的颜色,当然这里不能直接用RGB颜色代码了,你可以去color里寻找一个你中意的颜色,实在没有可以自己新建,然后在这里调用。
</style>
<style name="TextAppearance.Widget.IconMenu.Item" parent="@style/TextAppearance.Small">
<item name="textColor">@color/primary_text_lighte</item>
</style>
3、关于ExpandedMenu,看这字面意思就是扩展菜单,简单点儿说就是当你在MENU菜单里点更多的时候弹出的二级菜单。所以,这里一样需要修改。
同样在styles.xml,查找ExpandedMenu,定位到
<style name="Theme.ExpandedMenu" parent="@style/Theme">
<item name="listViewStyle">@style/Widget.ListView.Menu</item>
<item name="windowAnimationStyle">@style/Animation.OptionsPanel</item>
<item name="background">@null</item>
<item name="itemTextAppearance">?textAppearanceLargeInverse</item>
</style>
在这里,加入一行比如<item name="textColor">@color/primary_text_lighte</item>覆盖父级定义,来定义二级菜单的字体颜色。原理同上。
4、最后,编译回去,替换进手机,重启,完成。