how can i modify the size of the dropdown part of the spinner?? do i have to do that in XML or in the code itself?
You can not change the size of spinner as it is default widget. But you can make it custom using background image. Here is my code:
<Spinner
android:id="@+id/spinner"
android:layout_width="fill_parent"
android:layout_height="45dp"
android:drawSelectorOnTop = "true"
android:layout_marginLeft="20dp"
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:layout_below="@+id/placeCity"
android:paddingLeft="5dip"
android:background="@drawable/myspinner_background"
/>
<ImageView
android:id="@+id/imageView1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignRight="@+id/spinner"
android:layout_alignTop="@+id/spinner"
android:layout_marginRight="5dp"
android:layout_marginTop="10dp"
android:src="@drawable/down" />
This is written in XML. And make another file called myspinner_background.xml in drawable folder. Inside that, write this code:
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<stroke
android:color="#f269be"
android:width="2dp" />
<solid
android:color="#ECC8EC" />
I'm no pro but after thousands of tries, here's the ultimately simple solution... just copy this line in Spinner tag...
android:dropDownHeight="100dp" <!--change 100dp to your requirement-->
you can also modify width...
android:dropDownHeight="100dp" <!--change 100dp to your requirement-->
This works well with autocompletetextview.
In xml, I believe you set it with android:dropDownWidth. This worked for me:
<Spinner
android:id="@+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:dropDownWidth="dp_value_you_desire" />