Android 如何更改自定义微调器文本颜色

Android 如何更改自定义微调器文本颜色,android,xml,textview,spinner,Android,Xml,Textview,Spinner,我正在从事一个android项目,在这个项目中,我必须在注册表中实现一个自定义微调器,用于选择职业、姓氏。微调器功能正常,但微调器是一个自定义微调器,它不接受要更改的文本颜色。有什么办法可以改变文字的颜色吗 下面是我的xml代码: <com.infantstudio.CatholicMithrulu.Spinner.SearchableSpinnerProfestion android:id="@+id/profestion_spinner" android:layout_

我正在从事一个android项目,在这个项目中,我必须在注册表中实现一个自定义微调器,用于选择职业、姓氏。微调器功能正常,但微调器是一个自定义微调器,它不接受要更改的文本颜色。有什么办法可以改变文字的颜色吗

下面是我的xml代码:

<com.infantstudio.CatholicMithrulu.Spinner.SearchableSpinnerProfestion
    android:id="@+id/profestion_spinner"
    android:layout_width="100dp"
    android:layout_height="wrap_content"
    android:entries="@array/profestion"
    app:hintTextCountry="Select"/>


您说过您正在使用自定义微调器。还应使用自定义视图或自定义列表绑定数据。您应该更改自定义列表的文本颜色。

要创建自定义微调器,您需要设置自定义布局,在其中更改文本颜色,如以下示例所示

ArrayAdapter<String>  arrayAdapter = new ArrayAdapter<String>(this, R.layout.spinner_adapter, getResources().getStringArray(R.array.profestion));
    profestion_spinner.setAdapter(arrayAdapter);
ArrayAdapter ArrayAdapter=newarrayadapter(这个,R.layout.spinner_适配器,getResources().getStringArray(R.array.profestion));
旋转器设置适配器(阵列适配器);
您可以在此处更改文本颜色:- spinner\u adapter.xml

<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:textSize="@dimen/_12sdp"
    android:padding="@dimen/_8sdp"
    android:textColor="@color/txt_color">

</TextView>


如果使用spinner\u adapter.xml,可以设置文本颜色。但是,如果您想根据条件值动态更改文本颜色,这将不起作用

post row file of spinner,那么您是否已指定textview的文本颜色?