0

Thanks to see my queries. Am developing an android mobile app min version:- 2.2 and target version:-4.4 App theme:-android:Theme.Holo.Light

Query:- 1. Spinners is shows as drop down list in the "android:Theme.Holo.Light" theme. if once i changed the theme to "android:Theme.Light spinner" values are displays those values in popup window but action bar is not displays in this theme.

My requirement is want to show the values of spinner in popup window.

How to resolve it? I below mention my code for your review.

Spinner in /XML file:-

  <Spinner
        android:id="@+id/spinner"
        android:layout_width="275dp"
        android:layout_height="match_parent"
        android:layout_gravity="center"
        android:layout_marginTop="20dp"
        android:drawSelectorOnTop="true"/>




ArrayAdapter<String> dataAdapter = new ArrayAdapter<String>(this,android.R.layout.simple_spinner_item,(List<String>));
                    dataAdapter2.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);

Thanks, Naresh T

Manishika
  • 5,478
  • 2
  • 22
  • 28
KingNaresh
  • 37
  • 1
  • 5
  • possible duplicate of [How do I create an Android Spinner as a popup?](http://stackoverflow.com/questions/6286847/how-do-i-create-an-android-spinner-as-a-popup) – 0101100101 Aug 12 '14 at 09:07

3 Answers3

3

If you need to show your spinner values as a popup/dialog then add the below line to your spinner in xml

android:spinnerMode="dialog"

For dropdown

android:spinnerMode="dropdown"

santoshavss
  • 221
  • 1
  • 6
2
Try this solve your problem 

<Spinner
            android:id="@+id/switch_role_spinner"
            android:layout_width="275dp"
            android:layout_height="50dp"
            android:layout_gravity="center"
            android:spinnerMode="dropdown"
            style="@android:style/Widget.Spinner.DropDown"
            android:layout_marginTop="20dp" />
PLP
  • 714
  • 3
  • 13
0

This answers your question. Summary: Remove the spinner completely and use a TextView instead. Make it show an AlertDialog on click. Insert the items in the AlertDialog using setItems(...). Put the selected item in the TextView when an item is clicked.

Community
  • 1
  • 1
0101100101
  • 5,786
  • 6
  • 31
  • 55