如何在ActionBarSherlock上更改IcsSpinner的文本颜色?

Arc*_*pgc 5 android actionbarsherlock android-actionbar

我的行动栏目前是这样的:

在此输入图像描述

我希望它是这样的:

在此输入图像描述

忽略徽标旁边的黑线.主要是我想要的是change the color of the text in the IcsSpinner to white

我的活动代码是:

    ArrayAdapter<String> listAdapter = new ArrayAdapter<String>(this,
            R.layout.sherlock_spinner_item, cities);
    listAdapter
            .setDropDownViewResource(R.layout.sherlock_spinner_dropdown_item);
    setContentView(mViewPager);
    final ActionBar bar = getSupportActionBar();
    bar.setCustomView(R.layout.custom_actionbar);
    bar.setIcon(R.drawable.logo);
    bar.setDisplayShowCustomEnabled(true);
    IcsSpinner citySpinner = (IcsSpinner) (bar.getCustomView())
            .findViewById(R.id.city_spinner);
    citySpinner.setAdapter(listAdapter);
Run Code Online (Sandbox Code Playgroud)

我的custom_actionbar.xml是:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="fill_parent"
    android:gravity="right|center_vertical"
    android:orientation="horizontal" >

    <com.actionbarsherlock.internal.widget.IcsSpinner
        android:id="@+id/city_spinner"
        android:layout_width="wrap_content"
        android:layout_height="match_parent"/>

</RelativeLayout>
Run Code Online (Sandbox Code Playgroud)

我甚至想要旋转器just left to the refresh icon.就像第二张图片一样.

谢谢

Jak*_*ton 15

您需要使用getSupportActionBar().getThemedContext()作为Context适配器的实例来扩展布局.这将使用适合于在操作栏内膨胀窗口小部件的任何主题,而不是用于活动内容的主题集.