This is a lousy response, but I got all my spinners working by copying/ examining the code in the example program called "translate". On my PC its located in c:\user\me\workspaces\translate. -jp
On Sep 9, 4:19 am, EverettG <egoode...@speakeasy.net> wrote: > I am creating a Spinner but when it displays in the Emulator it does > not display any sort of arrow to let the user know to click on it. If > you click on it, it works properly and you can choose from the items. > I have looked through Internet resources and three books but cannot > seem to find an answer to this. Here are my files: > spinner.xml: > <?xml version="1.0" encoding="utf-8"?> > <LinearLayout xmlns:android="http://schemas.android.com/apk/res/ > android" > android:orientation="vertical" > android:layout_width="fill_parent" > android:layout_height="fill_parent" > > > <Spinner > android:id="@+id/testSpinner" > android:layout_width="fill_parent" > android:layout_height="wrap_content" > android:drawSelectorOnTop="true" > /> > <Button > android:id="@+id/enableToggleButton" > android:layout_width="fill_parent" > android:layout_height="wrap_content" > android:text="Set enable toggle" > /> > <Button > android:id="@+id/changeColorButton" > android:layout_width="fill_parent" > android:layout_height="wrap_content" > android:text="Change Spinner Background Color" > /> > </LinearLayout> > > arrays.xml > <?xml version="1.0" encoding="utf-8"?> > <resources> > <string-array name="months"> > <item>Jan</item> > <item>Feb</item> > <item>Mar</item> > <item>Apr</item> > <item>May</item> > <item>Jun</item> > <item>Jul</item> > <item>Aug</item> > <item>Sep</item> > <item>Oct</item> > <item>Nov</item> > <item>Dec</item> > </string-array> > </resources> > > TestSpinner.java > package com.aapg.AndroidViews; > > import android.app.Activity; > import android.graphics.Color; > import android.os.Bundle; > import android.view.View; > import android.widget.ArrayAdapter; > import android.widget.Button; > import android.widget.Spinner; > > public class TestSpinner extends Activity > { > private int spinnerBackgroundColor = Color.BLUE; > //private static final String[] MONTHS = new String[] > // > {"Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"}; > > @Override > public void onCreate(Bundle savedInstanceState) > { > super.onCreate(savedInstanceState); > setContentView(R.layout.spinner); > > //Get a reference to the Spinner. > final Spinner testSpinner = (Spinner)findViewById(R.id.testSpinner); > testSpinner.setBackgroundColor(Color.BLUE); > //Set up the ArrayAdapter. > //ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>(this, > //android.R.layout.simple_spinner_item, MONTHS); > ArrayAdapter<CharSequence> arrayAdapter = > ArrayAdapter.createFromResource(this, > R.array.months, android.R.layout.simple_spinner_item); > //Set up the DropDownViewResource. > arrayAdapter.setDropDownViewResource > (android.R.layout.simple_spinner_dropdown_item); > //Attach the Spinner to the ArrayAdapter. > testSpinner.setAdapter(arrayAdapter); > > final Button enableToggleButton = (Button)findViewById > (R.id.enableToggleButton); > enableToggleButton.setOnClickListener(new Button.OnClickListener() > { > public void onClick(View v) > { > changeEnabled(testSpinner); > }//onClick(). > });//Button.setOnClickListener(). > > final Button changeColorButton = (Button)findViewById > (R.id.changeColorButton); > changeColorButton.setOnClickListener(new Button.OnClickListener() > { > public void onClick(View v) > { > changeSpinnerBackgroundColor(testSpinner); > }//onClick(). > });//Button.setOnClickListener(). > }//onCreate(). > > public void changeEnabled(Spinner testSpinner) > { > if(testSpinner.isEnabled()) > { > testSpinner.setEnabled(false); > }//if(testSpinner.isEnabled()). > else > { > testSpinner.setEnabled(true); > }//else. > }//changeEnabled(Spinner testSpinner2). > > public void changeSpinnerBackgroundColor(Spinner testSpinner) > { > if(spinnerBackgroundColor == Color.BLUE) > { > testSpinner.setBackgroundColor(Color.YELLOW); > spinnerBackgroundColor = Color.YELLOW; > }//if(SPINNER_BACKGROUND_COLOR == Color.BLUE) > else > { > testSpinner.setBackgroundColor(Color.BLUE); > spinnerBackgroundColor = Color.BLUE; > }//else. > }//changeSpinnerBackgroundColor(Spinner testSpinner). > > }//AutoComplete class. > > Thanks for your help. > > EverettG. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to android-beginners-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---