如何在android中更改微调器的大小?

时间:2011-02-21 05:26:42

标签: android spinner

我们可以更改弹出窗口的大小,单击微调器时会显示

实际上看起来非常宽,我想减少弹出窗口的宽度,但不知道怎么可能

1 个答案:

答案 0 :(得分:2)

您可以在布局文件中更改这些设置。 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"/>

将适配器资源更改为新的布局文件:

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