The problem with stock Android"/>
  简体   繁体   中英

Icon color on different themes

Different Android devices have different themes. That means, that background colors, like in dialogs, may differ among Android versions and among manufacturers.

This may result into icons getting "invisible":

比较:2.3 < - > 4.0.3

The problem with stock Android themes could be solved relatively easy, by providing different colored icons in target specific folders, eg white icons in a folder drawable-v14 , and black ones in drawable-v10 . But that does not solve the issue that comes with customized themes from manufacturers, may it be TouchWiz, Blur or Sense. It is simply not possible to cover every device by this method.

Another way would be, to draw a small black border around white icons, and vice versa. But if the background would be gray, like in ICS, it wouldn't look good, either.

So, the question is: How to provide custom icons, that will work well on every theme, without touching the theme itself?

Accounting for all vendor choices (and mistakes) would be a pain.

I see a couple of options:

  1. Explicitly select a stock theme and hope for the best
  2. Select a custom theme derived from a stock theme, where you control the background color
  3. Dynamically evaluate the background color for the chosen theme, and set the icon based by a tipping point (eg dark icons if background is light enough). Not sure if this would be practical, but at least it should be somewhat universal.

I recently went with the hard-coded colors in a derivative theme to fix a bug in the Nook dialog color selections for a dialog. More extensive testing would probably show me another platform that I just made worse with that.

Hopefully someone has a better answer than those, because none of those seem completely clean and universal. Reading your post again, it looks like none of those options meet your criteria of not touching the theme, either.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM