小编fre*_*ing的帖子

基于主题改变Drawable

我有两种不同颜色的图像,对应Android中的两个不同主题.我想在我的Action Bar中使用它们.我想参考一个drawable的图标,主题不可知,但有可绘制的参考灯光主题的浅色和浅色主题的深色.

在菜单中:

    <item
        android:id="@+id/menu_attach_existing_picture"
        android:icon="@drawable/buttonface_picture"
        android:showAsAction="always"
        android:title="@string/menu_attach_existing_picture">
    </item>
Run Code Online (Sandbox Code Playgroud)

然后在风格中我希望在light主题中将@ drawable/buttonface_picture映射到@ drawable/buttonface_picture_light,为黑暗主题设置@ drawable/buttonface_picture_dark.

我觉得必须有办法,但我找不到语法.如果它改变了什么,我正在使用ActionBarSherlock.

android styles

30
推荐指数
1
解决办法
9571
查看次数

标签 统计

android ×1

styles ×1