16

I'd like to decrease/change the spinner size which includes:

  1. the spinner object size
  2. the font displayed (its size and color)
  3. When I open spinner the list view which is displayed (its font size and color)
Andre Silva
  • 4,693
  • 9
  • 49
  • 64
Adil Bhatty
  • 16,754
  • 34
  • 77
  • 114

2 Answers2

35

You can change these settings in the layout file. The hello-spinner tutorial is very useful.

http://developer.android.com/guide/tutorials/views/hello-spinner.html

Add a new XML file to your layout folder.

Example: spinnerLayout.xml

 <?xml version="1.0" encoding="utf-8"?>
    <TextView xmlns:android="http://schemas.android.com/apk/res/android"
              android:id="@+id/spinnerTarget"
              android:layout_width="fill_parent"
              android:layout_height="wrap_content"
              android:textSize="14pt"         
              android:textColor="#FF8B1500"
              android:gravity="center"/>

Change the adapter resource to your new layout file:

adapter = ArrayAdapter.createFromResource(
                this, R.array.sound, R.layout.spinnerLayout);
Leon
  • 2,246
  • 1
  • 20
  • 17
  • Yeah it changed the whole UI object size, but I want to customize the spinner. May be like using setDropDownResource, but I am not able to figure out how to make such resource. – Adil Bhatty May 28 '10 at 06:51
9
android:padding="0dip"

in my spinner makes it smaller using

android.R.layout.simple_spinner_item 

when making the array adapter seems to make it smaller also, but i have no idea whether or not that is a sane thing to do.

duggu
  • 37,191
  • 12
  • 114
  • 111
Ray Tayek
  • 9,443
  • 7
  • 45
  • 83