Android Question Color differences in various Gadgets

Discussion in 'Android Questions' started by Paul Leischow, May 14, 2019.

  1. Paul Leischow

    Paul Leischow Member Licensed User

    How do you deal with the various color differences in gadgets (or views) across the different versions of Android?
    I am currently developing on a Galaxy S7 running Android 8 using the default manifest and stock spinner and toggle buttons and everything looks fine.

    Then I test the same app on a Galaxy S5 running Android 5.1 and it becomes unreadable.
    If I change the text color in the designer to white so you can read it on Android 5, then you can't read it on Android 8.

    There is no option in the designer to colorize the background, only the text color.
    Is there a way to make the coloring the same across all versions of Android?
  2. JohnC

    JohnC Well-Known Member Licensed User

    When a view's color property is set to "Default" (in the designer the value will appear as a gray/white checkered box with a red diagonal line across it), then it will use the device's "Theme" color for that view's color property.

    By having all the colors of a view set to their default value, then your app "should" look ok on various devices because the maker of each device should have created a proper "theme" where the colors don't clash with each other.

    However, if you manually specify a color in the designer or code, then you are overriding the devices theme color, and even though your chosen color looks fine on your device (using your device's theme), your manually specified color could easily clash with the color themes of other devices as you have seen.

    Additionally, as you have noticed, some views don't allow you to specify all the colors of a view, like the background. So this adds to the difficulty on preventing clashing colors when run on a variety of devices.

    So, you can either set all views to use the "default" color values so all the views in your app should be readable on various devices using each device's color theme (which can vary from light or dark themes)...

    ...Or you can create your own "theme" in your apps manifest that will specify all the default colors (including non-runtime modifiable colors) of your app so you can prevent any clashes and make your app's appearance be consistent across devices.

    Here is an example of how to create a theme in your apps manifest:
    Last edited: May 14, 2019
  3. Paul Leischow

    Paul Leischow Member Licensed User

    I agree, it "should" look ok but it doesn't. If I leave toggle buttons to default, on android 8 they have greyish white background with white text... can't easily read, and on android 5 they have greyish black background with black text, also can't easily read.

    Have others not noticed these issues ??

    I have read through various posts like the link you mention but none of them explain where you get the names from for assigning the color to.
    @Color/actionbar or @Color/statusbar are self explanatory but what about coloring the background of a togglebutton or spinner, etc ??
  4. Erel

    Erel Administrator Staff Member Licensed User

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice