如何增加微调项字体大小? [英] How to increase spinner item font size?
本文介绍了如何增加微调项字体大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这是我的微调code:
This is my spinner code:
Spinner food = (Spinner) findViewById(R.id.spinner1);
ArrayAdapter<CharSequence> foodadapter = ArrayAdapter.createFromResource(
this, R.array.item_array, android.R.layout.simple_spinner_item);
foodadapter.setDropDownViewResource(android.R.layout.simple_spinner_item);
food.setAdapter(foodadapter);
这是我所描述的微调布局文件的一部分:
This is a part of the layout file where I have described the spinner:
<Spinner
android:id="@+id/spinner1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:layout_toRightOf="@+id/textView1" />
这是 item_array
:
<resources>
<string name="item_picker">Select an iten</string>
<string-array name="item_array">
<item>Pizza</item>
<item>Burger</item>
<item>Sandwiches</item>
<item>Bread</item>
<item>Pastries</item>
<item>Snackers</item>
</string-array>
</resources>
注:我不想 simple_spinner_dropdown_item
我只是想增加大小。我该怎么办呢?
I just want to increase the size. How can I do that?
推荐答案
保存以下XML作为spinner_layout.xml布局文件夹
Save the below xml as spinner_layout.xml in layout folder
<?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:textColor="#000000"
android:textSize="13sp"
/>
更改您要的TEXTSIZE。 并使用下面的适配器$ C $三来一补吧。
change the textSize which you want. and use the below adapter code to fill it.
Spinner food = (Spinner) findViewById(R.id.spinner1);
ArrayAdapter<CharSequence> foodadapter = ArrayAdapter.createFromResource(
this, R.array.item_array, R.layout.spinner_layout);
foodadapter.setDropDownViewResource(R.layout.spinner_layout);
food.setAdapter(foodadapter);
这篇关于如何增加微调项字体大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文