2010-05-28 87 views

回答

32

您可以在佈局文件中更改這些設置。 hello-spinner教程非常有用。

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

一個新的XML文件添加到您的佈局文件夾。

例子: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"/> 

更改適配器資源到新佈局文件:使用

android.R.layout.simple_spinner_item 

adapter = ArrayAdapter.createFromResource(
       this, R.array.sound, R.layout.spinnerLayout); 
+0

是的,它改變了整個UI對象的大小,但我想定製微調。可能就像使用setDropDownResource一樣,但我無法弄清楚如何製作這樣的資源。 – kaibuki 2010-05-28 06:51:36

+0

好吧,我明白你的意思。我編輯了以前的帖子。 – sirlunchalot 2010-05-28 07:20:25

7
android:padding="0dip" 

在我的微調使得小當進行陣列Y適配器似乎也使它更小,但我不知道這是否是一個理智的事情要做。