I've been trying to do this for a couple of days so I thought I would share
how I eventually did it.

I created a new xml file with the name spinnerrow.xml (Notice that there are
no underscores and no caps, I had trouble with xml files with those
characters)

<?xml version="1.0" encoding="utf-8"?>

<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android";
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:textSize="5pt"
    android:singleLine="True"
    android:id="@+id/spinnerTarget"
    android:textColor="#000000"
    android:gravity="center"
/>

In my main xml file I had the following definition:

<Spinner android:id="@+id/Spinner01" android:layout_width="wrap_content"
            android:layout_height="wrap_content" android:hint="Click to
change compounding type"
            android:text="text"/>


In my java file I had the following in the onCreate section:

Spinner mySpinner = (Spinner) findViewById(R.id.Spinner01);
        ArrayAdapter <CharSequence> mySpinnerArrayAdapter =
ArrayAdapter.createFromResource(this, R.array.compoundingSpinner,
R.layout.spinnerrow);

mySpinnerArrayAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
        mySpinner.setAdapter(mySpinnerArrayAdapter);

        mySpinner.setOnItemSelectedListener(new MyOnItemSelectedListener());

I was in the process of creating a custom ArrayAdapter but realized that I
had what I was looking for without it.

Good Luck
Connie

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to