Android action bar showing icons in both light and dark themes - android

I want to show an action bar with icons in both light and dark themes. So I'm wondering whether I need to duplicate all the icon files?
I also wonder why the official icons are either opaque white or black, but the guidelines say its alpha should be 80% and 60% for each theme respectively. Should I change every png?
In other words, is there any simple way to use an action bar with icons that work in both themes?

Related

How to support multiple colors (more than two color) for Android Notification icon?

I am working on Android app (API level >23). And I have to
support Notification.
And my notification icon is supported more than two colors.
If I use that icon then icon displays in grey in notification
pannel.
So I have created background transparent and completly white icon
and set color dynamically.
But I am able to set only one color (setColor()).
So my question is :-
How to support multiple colors (more than two color or color gradients) for Android Notification icon?
Note :- I have taken reference of Android Push Notifications: Icon not displaying in notification, white square shown instead
Thanks for support in advance.
If your app targets SDK 21+ the system will always tint your notification icon
white when it's displayed in a dark status bar
dark grey when it's displayed on a light status bar (API 23+)
dark grey when it's collapsed at the bottom of the notification shade
the color you set when it's part of a notification in the notification shade (API 24+, before that you'd have a white icon over a colored circle as the default large notification icon)
You have no control over the color other than what's described above.
But you can work with alpha channel. You can achieve different degrees of white/dark grey/color in your icon.
No, there's no other way. Pass this on to your designer and management.
Android 5.0 Behavior Changes
Notifications
Material design style
Update or remove assets that involve color. The system ignores all non-alpha channels in action icons and in the main notification icon. You should assume that these icons will be alpha-only. The system draws notification icons in white and action icons in dark gray.
Source: https://developer.android.com/about/versions/android-5.0-changes.html#NotificationsMaterialDesignStyle
Notifications
Make sure your notifications take these Android 5.0 changes into account. To learn more about designing your notifications for Android 5.0 and higher, see the notifications design guide.
Material design style
Notifications are drawn with dark text atop white (or very light) backgrounds to match the new material design widgets. Make sure that all your notifications look right with the new color scheme. If your notifications look wrong, fix them:
Use setColor() to set an accent color in a circle behind your icon image.
Update or remove assets that involve color. The system ignores all non-alpha channels in action icons and in the main notification icon. You should assume that these icons will be alpha-only. The system draws notification icons in white and action icons in dark gray.
from:
https://developer.android.com/about/versions/android-5.0-changes.html#NotificationsMaterialDesignStyle

Is it possible to 'style' icons in Android?

For example, I downloaded an icon from Google which is simply a check mark. I put this icon in my app's action bar but unfortunately the icon is black and my action bar is quite dark so it doesn't look good. Is there a way to style the icon automatically or do I have to edit the png to be white instead? I found this website which mentions styling an icon but I'm not sure if that's a guideline for a designer or actually something that goes into code.
What is the standard way to style icons? Do I need to download black and white icons and use the appropriate one at runtime based on the app theme? That seems like it could be a pain.
For myself, if I need to style an icon, I use photoshop to edit the icon. But any image processing software should work if you are familiar with it.
However, the icons you mentioned that are available online usually come with both a dark and light theme. So if you have a dark action bar theme, you can simply download and use the light version of the icon.
For your checkmark icon specifically, you can download either the light or dark version of it here, here, or here. Hope this helps.
look at this web site http://bitdroid.de/Android-Material-Icon-Generator/
for any question or how it work: http://forum.xda-developers.com/tools/programming/tool-android-material-icon-generator-t3333159

What is the name of the Android icon?

Is it the standard icon? What is it called? (android.R.drawable.???)
I am referring to the update or refresh icon.
Icon (on the left)
You can get this icon, like #panini said, in the Android Design Downloads page.
There are two versions, the Holo Light and Holo Dark, and it is the Holo Dark one that is shown in your link. An example of the image is shown in the same page under "Action Bar Icon Pack".

Overlay action bar with a translucent status bar

I'm trying to achieve the effect shown here: http://www.youtube.com/watch?v=6QHkv-bSlds&t=15m48s by Nick and the boys. I can get the action bar to be overlayed, but cannot figure out how to extend this to the status bar. I would also like to know how they managed the transparent black background behind the navigation bar (but this isn't as crucial).
Any help / advice would be greatly appreciated as I currently have no idea how this is done (and am starting to worry it may just be an image rather than an actual implementation).
Edit: i know how to make the bars fully transparent (thats the easy part)! I dont know how to extend the actionbar background to appear behind the now transluscent status bar
I had the same question and found this library: https://github.com/jgilfelt/SystemBarTint
Have a look at line 300 in:
https://github.com/jgilfelt/SystemBarTint/blob/master/library/src/com/readystatesoftware/systembartint/SystemBarTintManager.java
setupStatusBarView() Adds a view to the window's decor. This allows you to later set a color/drawable to this view.
If using the SystemBarTint library, the following will allow you to force the status bar to a specified color, which you can then match to your action bar's background:
SystemBarTintManager tintManager = new SystemBarTintManager(this);
tintManager.setStatusBarTintEnabled(true);
tintManager.setStatusBarTintColor(Color.parseColor("#DD000000"));
In this case you would set your action bar's background to: #DD000000
As described in the Android 4.4 APIs:
You can now make the system bars partially translucent with new themes, Theme.Holo.NoActionBar.TranslucentDecor and Theme.Holo.Light.NoActionBar.TranslucentDecor. By enabling translucent system bars, your layout will fill the area behind the system bars, so you must also enable fitsSystemWindows for the portion of your layout that should not be covered by the system bars.
If you're creating a custom theme, set one of these themes as the parent theme or include the windowTranslucentNavigation and windowTranslucentStatus style properties in your theme.
In your case (where you want the ActionBar), the second option - including the two new properties into your theme - will give you a translucent Navigation and Status bar.
They are using the new Translucent system bars feature (on Android 4.4 and up).
Translucent system bars
You can now make the system bars partially translucent with new
themes, Theme.Holo.NoActionBar.TranslucentDecor and
Theme.Holo.Light.NoActionBar.TranslucentDecor. By enabling translucent
system bars, your layout will fill the area behind the system bars, so
you must also enable fitsSystemWindows for the portion of your layout
that should not be covered by the system bars.
If you're creating a custom theme, set one of these themes as the
parent theme or include the windowTranslucentNavigation and
windowTranslucentStatus style properties in your theme.

Light-colored icon on ActionBar not visible on system menu?

I am using the ActionBarCompat sample. If our action bar has a dark background, we want to use white-colored icons. But these icons are also used for the system menu items (when they don't fit on the action bar, pre-honeycomb). So the white icons aren't visible on the system menu white background. Example:
What can we do about this? Is there a way to use the dark version of icons when shown on the system menu, and light colored when on the action bar?
Thanks
There are only two ways to handle this issue. Either change the color of your ActionBar, or edit the color of your icons.
I would suggest that best combination for Actionbar and icons would be Red color for Actionbar and white color for your icons.
And how can white icons be visible in white background??? If you remember in Menu icons we have grey background with white icons. That's why they are easily visible in Menu's.

Categories

Resources