Android L - Icon background color - android

I'm trying to color the icon's background of my notifications on Android L. I think I saw an API during GoogleIO and the attached image actually shows a green background, but I can't find anything on the documentation.
Can you point me to something?
BONUS QUESTION: How about the background color for Wear Notification? Does it use the same API?

This color can be changed like this:
.setColor(context.getResources().getColor(R.color.theme_primary))

Related

Why is my icon not shaped like other icons on Android?

I'm using Launching Icon Generator to build my Android Icon Apps, but I can't get the same shape to the other icons in Android. What's wrong?
My icon in the mobile screen looks like that...
I'm using Lainching Icon Generator in this way...
How to be sure that my Icon will adapt the Icon Shapes in different Android versions?
Remove the padding which is set to 25 in attached screenshot. Also make sure to have transparent background.
for better solution u can use android studio in build tab "Image Asset".
from there u can select foreground as your icon and background as your background theme.

Change notification style

does anyone know how to define style like mediastyle for notifications in android. I want to use different background color for notification that appear on devices who has android version 5.0 or above. I want to use same color, but I want to use different height of notification, and I don't want a buttons in notification. Currently I use custom view for notification that has same background color like medaistyle notification, but custom view appears only on devices that has version of android lower then 5.0 . Can anyone help please
Thank you very much

?attr/colorPrimary support version?

I am in a fairly serious predicament. I have built my entire app using ?attr/colorPrimary to pick the color for background shapes, as I have devised a way to dynamically change the theme and color. This works perfectly on 5.0, but on all 4.x devices, ?attr/colorPrimary crashes the app. Why does Android studio not alert developers to this incompatibility?
Is there a support version of ?attr/colorPrimary?
colorPrimary is already part of AppCompat as of version 21 and works back to API 7. Your problem is instead with your theming code.
I believe it was added after Android Lollipop - API 21.
At least this link shows that it was added between API 20 and 21:
https://developer.android.com/sdk/api_diff/21/changes/android.R.attr.html
attr/colorPrimary just point to colorPrimary defined in current theme.
I'm not sure how you implemented your theme.. But you can create your own attr... This option is good only if you support several themes.
If you have a single theme, I believe you can replace it by a color.
API 21:
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.
The problem is a glitch in Android code. See this, it is not the exact same but the reason is.
In case anyone out there has this problem, I want to explain my workaround.
Remove all instances of "?attr/color(Primary, Dark, or Accent)" and attempt to mimic the effect in each individual element in each individual activity. This is not a full work around, but for me it works. Google really needs to resolve this issue. If you know a better work around, please let me know and I will accept it as the better answer as long as it works.

android notification background color is not white on lollipop

As we known that Android lollipop force set the notification background color to white, so we can set the style of TextView according to different sdk version by putting style.xml in folder values-v21.
So here comes my question, on some third party ROMs, for example, the EMUI developed by Huawei tech co., the background of notification is not white(nearly black), by setting style to
android:TextAppearance.Material.Notification.Title
the color of the text is almost black, as a result, we cannot see the text clearly. I had been searching the internet for almost two days but find nothing helps.
I am trying to get the color of the notification background and set the text color dynamically, but I don't know how to accomplish this.
Need your help, thanks a lot.
Ok, so I just use the official API to set the notification info, that would inflate the default notification layout (status_bar_latest_event_content.xml)instead of my custom layout.
The rom changed the default background and text-color of the status_bar_latest_event_content.xml, but it wouldn't (or can't) change the custom layout.
mBuilder.setLargeIcon(combineBitmap).setContentText(notifyString).setSubText("fff");
remove the android:targetSdkVersion="21" from manifest.xml. it will work! and from this there is no prob at all in your apk it just a trick i apply this and i found colorful icon in notification and all features will remain same which u earlier use

Where can I find the exact grey color of the unread message // mail // Gmail

In my app, I will have a ListView with read and unread items, so I would like to use the same colors than the latest AOSP.
The 2 grey color shades of the messaging app sounds quite correct and I would like to know where I can have a look in Android source code to find the exact same grey. (read = white?)
Note: using a screenshot and a color picker is not acceptable, I don't want to "guess" the correct hexadecimal code.
I am totally aware that I could use my own colors, but using the system one sounds better.
The Android design website doesn't give me any clue at the color section: http://developer.android.com/design/style/color.html
Any idea/suggestion?
The lighter color is: #FFFFFF
The darker color is: #EEEEEE
I use the Eye Dropper Chrome Extension to figure out color codes from any web page

Categories

Resources