如何更改微调的文本颜色 [英] How to change the Text color of Spinner
本文介绍了如何更改微调的文本颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
请帮我改变了微调的文本颜色。
Please help me on changing the text color of the spinner.
推荐答案
试试这个
custom_spinner_item.xml
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:gravity="top"
android:singleLine="true"
android:textColor="@color/iphone_text" />
在Java的code
In Java code
Spinner spnCategory= (Spinner)findViewById(R.id.my_spinner);
..
ArrayAdapter<String> adptSpnCategory = new ArrayAdapter<String>this,R.layout.custom_spinner_item, alCategoryName);
adptSpnCategory.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
spnCategory.setAdapter(adptSpnCategory);
spnCategory.setOnItemSelectedListener(new OnItemSelectedListener()
{
public void onItemSelected(AdapterView<?> arg0, View arg1,int arg2, long arg3)
{
}
public void onNothingSelected(AdapterView<?> arg0)
{
}
});
这篇关于如何更改微调的文本颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文