Answer the question
In order to leave comments, you need to log in
How to deal with icons in different themes in the application?
The application has two themes: light and dark, but the icons were used only in light colors.
Icons are located in the actionbar and drop-down menus. In order for everything to be displayed adequately, I chose a background color on which they would "contrast", but when I started making applications in accordance with the material design, it turned out that the white icons were almost indistinguishable on the light drop-down menu.
What to do? how to proceed? Do you really have to somehow switch icons when changing the theme? Or is it possible to leave a "contrasting" background, and wouldn't that go against the rules of material design?
Answer the question
In order to leave comments, you need to log in
This is done quite simply.
1) Create custom attributes for each image depending on the theme:
<declare-styleable name="AppTheme">
<attr name="imageLogo" format="reference" />
</declare-styleable>
<style name="Theme" parent="@android:style/Theme.Holo.Light">
<item name="attr/imageLogo">@drawable/logo_light</item>
</style>
<style name="Theme.Dark" parent="@android:style/Theme.Holo">
<item name="attr/imageLogo">@drawable/logo_dark</item>
</style>
<ImageView
…
android:src="?attr/imageLogo"/>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question