如何更改/减小 Android 微调器大小?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/2927012/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 07:55:26  来源:igfitidea点击:

How can I change/decrease the Android spinner size?

androidspinner

提问by kaibuki

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)
  1. 微调对象大小
  2. 显示的字体(大小和颜色)
  3. 当我打开微调器时显示的列表视图(其字体大小和颜色)

回答by sirlunchalot

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

您可以在布局文件中更改这些设置。hello-spinner 教程非常有用。

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

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

Add a new XML file to your layout folder.

将新的 XML 文件添加到您的布局文件夹。

Example: spinnerLayout.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"/>

Change the adapter resource to your new layout file:

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

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

回答by Ray Tayek

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.

当制作阵列适配器时,它似乎也变小了,但我不知道这样做是否明智。