问题描述
我正在布局XML文件中创建一个微调器,并为此微调器设置一个字符串数组.如果更改微调器的文本样式,则文本不受更改的影响.
I'm creating a spinner in my layout xml files and setting an string array to this spinner.If I change the textstyle of the spinner the text is not affected by the changes.
我在googlegroups中读到,微调器没有文本,因此无法更改textstyle,我必须更改微调器中显示的textview的样式.但是我该怎么做.最好在我的xml文件中.
I read in the googlegroups that a spinner has no text and therefore the textstyle can not be changed and I have to change the style of the textview that is shown in the spinner. But how can I do that. Preferably in my xml file.
推荐答案
创建支持微调框的适配器时,您可以设置微调框项目的布局.
When you create the Adapter that backs the Spinner you can set a layout for the spinner item.
spinner.setAdapter(new ArrayAdapter(this, R.id.some_text_view));
您可以按照自己的方式设置some_text_view的样式.
You can style some_text_view the way you want.
<TextView android:id="@+id/some_text_view" android:textStyle="bold" />
这篇关于如何更改微调框的文本样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!