views:

80

answers:

1

I'm writing an application that needs to work on a variety of Android devices, each with their own carrier-specific themeing.

Unfortunately, there's a problem in that the tab themes for each device are incompatible --- stock Android uses light-background, dark-foreground for the selected tab, but the HTC Desire uses dark-background, light-foreground, which means that icons designed for one look wrong on the other. (Also, the HTC Desire's themes has a bug where they've forgotten to set the foreground colour for selected tabs, which means what you actually get is dark-background, dark-foreground. The system applications all appear to set the foreground manually, but I've observed this in several user applications.)

So, in order to make the application look right on all devices, I figure that I have two real options:

  • completely customise my tab theme so we don't rely on the system theme at all

  • other

I'd rather not do the first because that why our application won't match the other applications on the device. But unless there's a clever way around this issue, that's what I'll have to do. Any suggestions? I can't be the first person to come across this. Is there, for example, any way to make Android change the colour of the icons automatically?

(In addition, there's an issue I'm still working on which is that system applications appear to display tabs different to user applications: there must be some theme setting somewhere I haven't found yet, but after scouring the source code there's no sign of it. Pointers appreciated.)

A: 

If you want to support all Android versions (1.5+), the first option is the easiest solution.

The system applications (e.g. Contacts app) use custom tabs. Take a look here: http://android.git.kernel.org/?p=platform/packages/apps/Contacts.git;a=tree (e.g. search for "tab_" in these folders: res/layout-finger, res/drawable-finger, res/drawable-hdpi-finger)

Edi
Unfortunately the Contacts app's custom tab stuff appears to be unfinished and isn't used --- ContactsUtils.createTabIndicatorView() isn't called from anywhere! In addition, the Browser app's bookmarks editor has completely standard tab code, no custom UI anywhere, and yet it too is appearing in system-app style...
David Given
Hmm... you seem to be right. By the way, one other thing that affects the tabs style is the "android:targetSdkVersion" from your manifest file. For example, if you set it to 7 you get another style than with 6.
Edi
Yes, I just found that myself. Very... intuitive! At least that mystery is explained. It also appears that none of the HTC Desire system applications use standard tabs, so I can't compare to see what they look like. The standard Froyo style guide is pretty much unreadable on the HTC Desire...
David Given