views:

138

answers:

1

I use this code to generate a spinner in my app:

    subCatAdapter = new ArrayAdapter<Subcategory>(this, android.R.layout.simple_spinner_item, subCategories);
    subCatAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

On my device (Motorola Milestone) and in the emulator this looks like the standard gray spinner widget. On of my colleagues uses a Motorola Backflip and on his device the Spinner is black. Now its very hard to read the font in the spinner.

What do I have to do to use my own view for the spinner? I don't mind to have the gray spinner on all devices, but it should always look the same on all devices.

+1  A: 

This is the exact reason why I'll stick with the Nexus One as my personal phone (avoiding the "value" that carriers and manufacturers add to their phones).

Anyway, you can actually go and copy the resources from the the SDK into your own project and use the progress bar from there. The directory is here: \android-sdk-windows\platforms\android-2.1\data\res. You'll also have to copy the animation drawable called something like "progress_large.xml":

<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
    android:drawable="@drawable/spinner_black_76"
    android:pivotX="50%"
    android:pivotY="50%"
    android:framesCount="12"
    android:frameDuration="100" />

Edit: Sorry, just realized you meant "spinner" not the "spinning progress bar". The idea is the same though: there's a "spinner_background.xml" and associated graphics in the same directory.

Brandon