Attend XDA's Second Annual Developer Conference, XDA:DevCon 2014!
5,813,583 Members 37,689 Now Online
XDA Developers Android and Mobile Development Forum

[Q] Menu Icons with different themes

Tip us?
 
Auroratic
Old
(Last edited by Auroratic; 11th January 2014 at 12:02 AM.)
#1  
Auroratic's Avatar
Member - OP
Thanks Meter 0
Posts: 45
Join Date: Jun 2013
Location: Austria
Default [Q] Menu Icons with different themes

Hello,
in the settings of my App the users can switch between Holo.Light and Holo theme.

But I show some Menu options in the ActionBar. I've copied the icons for Holo.Light into my App.
When I switch to Holo theme, the icons looks not really good.

How can I implement the icons for the dark theme?
 
Auroratic
Old
(Last edited by Auroratic; 11th January 2014 at 01:35 PM.)
#2  
Auroratic's Avatar
Member - OP
Thanks Meter 0
Posts: 45
Join Date: Jun 2013
Location: Austria
I've tried the following: http://stackoverflow.com/a/12339924

But it dont work..

values/attrs.xml:
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <declare-styleable name="main">
        <attr name="search_icon" format="reference" />
    </declare-styleable>

</resources>
values/styles.xml:
Code:
<?xml version="1.0" encoding="utf-8"?>
<resources>

    <style name="MyTheme" parent="android:Theme.Holo">
        <item name="search_icon" @drawable/ic_action_search</item>
    </style>

    <style name="MyTheme.Light" parent="android:Theme.Holo.Light">
        <item name="search_icon" @drawable/ic_action_search_light</item>
    </style>

</resources>
menu/main.xml
Code:
    <item
        android:id="@+id/action_search"
        android:icon="?search_icon"
.....
manifest:
Code:
<application
        android:theme="@style/MyTheme"
wheres the error? it does always show the @drawable/ic_action_search_light icon..
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes