How to handle different android UI's - android

I recently ran into a problem with my app, On most android phones I have encountered, the UI seems to be mostly light colored. Now though, it seems phones are making a switch over to a darker UI(droid x). Now I found this to be a problem for instance with spinners. I have not set a font color on my spinner, but it gets defaulted to black on all the UI's I have tested on, making it harder to read on the darker UI's. What is the best way to handle this? Pick a neutral color? Design for each UI? Or is there a way to set the font color so the phone's UI can pick it up and set it to their default color?

I had the same problem. I have created a custom theme as a workaround.
See Comment #8 of this link
http://code.google.com/p/android/issues/detail?id=5237

Related

?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.

Status bar colors and resources

I'm creating my own remote view for the status bar(notification center). I want the remote view to have the same background color as the other notifications and I want it to be consistent across devices, e.g. Samsung and stock Android.
The only layout information I managed to find was under \android-sdk\platforms\android-14\data\res\layout\status_bar_latest_event_content.xml
In addition I found icon guidelines however I couldn't find anything related to background color.
I played with Photoshop and found the default color for Stock Android (#111111), however I don't want to hard code it.
When not using any background color the default that I get is grayish (see attachment)
Any suggestions ?

Strange background of text in custom theme

I recently updated my app, changing it's design a bit. Amongst other things, I styled buttons with custom drawables (well - not exactly custom, just taken from ICS release). Everything works well, except for one of the users.
Instead of:
He sees:
This is a Button, but I have also other controls styled with the same background drawable and the problems appears there (so, it's not limited to buttons).
There are two changed style properties that these controls have in common. One is, of course, a background drawable. The other is textAppearance:
<item name="android:textAppearance">?android:attr/textAppearanceMediumInverse</item>
I came to a conclusion, that this user is using some strange theme, which alters the default value of textAppearance* styles. But I have no idea what attribute may control this "text background color" (android:background does not work, checked this just in case). Or maybe I'm looking in the wrong place and this problem is not related to textAppearance?
EDIT:
The background image is a semi-transparent PNG file.
Android version 2.3.7, Motorola Milestone. That's all I got.
EDIT 2, Fixed:
OK, the problem was at the users side, it turned out he was using CyanogenMod7 with forced 16bit trasparency. After switching that option off, everything works.
OK, the problem was at the users side, it turned out he was using CyanogenMod7 with forced 16bit trasparency. After switching that option off, everything works.

Should I set my TextView colours if my background colour is not set?

When I comes to specifying colours for an application, I recently came across #android:color. Is it recommended to try to always use predefined system colors?
I changed the colours of some of my labels to something brighter, so that they'll stand out against the black background. But then I start to wonder... would themes/skins (not familiar with those) and such cause the default background colour to be something other than black?
If so... what's the proper way to deal with colouring one's widgets?
(Disclaimer: I don't know Android. This is general UI design advice.)
If you set the foreground color, you should change the background color as well. Otherwise, if someone's background is set to something wacky, your labels could wind up invisible -- or at the least, hard to see -- and you'll have defeated the purpose of using different colors.
I'd recommend you leave the colors as they are, unless you can change the background color as well. Perhaps using a bold font or something would be a better idea.
You've got 2 options:
1) define explicitly fore/background colors of all of your elements
2) use only default colors, so when the user change its theme, everything will change accordingly. Personally, i prefer this way, but be careful if your UI's got some images
Be consistent, so you'll avoid issues when users change its themes. choose one and back to work!

How to Get Android System Colors

I've seen references on how to SET system colours, but I need to find out how you GET them - how do you find out what they are?
On the Samsung Galaxy S for example, the tab views, ListView highlights when you select an item, and the Summary text line on the preference screen are all blue.
There are many apps which immitate this style and I want to do the same. Obviously I cannot just hard code and set the colour to Blue, as other handsets use different colours.
The question is, is there a way to programmatically find out what colour the Preference Screen Summary Line, Tabs, or ListView selections are, so that you can then set that against a TextView elsewhere in your app?
How do I get the android system colours?
There is an answer to this question, but it is probably not the one you wanted to hear. There is no way to reliably do this. The "selection color" is actually part of a nine-patch image, which is provided on a platform specific basis. Some use the standard orange color, some (Sense) uses green, and others use red. With an exhaustive list of these you might be able to create a mapping from hardware to color, but this is not very effective because new hardware comes out all the time, and some of these phones allow sense to be uninstalled.
The only real thing you can do is to make your buttons consistent within the application itself, which is a hard enough task by itself. If you really have to have a custom item with a selection color (which is common enough), then my advice would be to copy the button resources from the platform of your choice (I like the default sdk resources myself) and then manually set them throughout your application. This way they will always look the same no matter which platform you are on, and so will always match your custom views. Note that this will require you to do more than just buttons. Dialogs and menus also will need to be modified, which is possible, but hard.
Really this is a flaw in the way Android was designed, and it causes a lot of us grief. I wish I had a better answer for you, but I think this is the best we've got.
You can specify colours to elements in your XML layout using the #android:color system variable:
<TextView android:background="#android:color/white" android:textColor="#android:color/black" />

Categories

Resources