【问题标题】:Prompt in spinner is displaying with white text微调器中的提示以白色文本显示
【发布时间】:2014-01-02 12:11:59
【问题描述】:

在我的应用中有一个微调器,微调器的选定项是白色的。

而且我的应用背景也是白色的。所以我看不到微调器上显示的文本(在 0 位置)

如何更改微调器的文本颜色。如果您还告诉我如何更改微调器的边框颜色,我将更加感谢。 Spinner 在白色背景中显示明亮。

我的代码:

        CustomAdapter1<String> arrayAdapter1 = new CustomAdapter1<String>(IRCMSActivity.this,
            android.R.layout.simple_spinner_item, divisions, 0);
    arrayAdapter1.setDropDownViewResource(R.drawable.spinner_button);
    spinner.setAdapter(arrayAdapter1);

自定义适配器类:

class CustomAdapter1<T> extends ArrayAdapter<String> {
    public CustomAdapter1(Context context, int textViewResourceId,
            String[] symboles, int value) {
        super(context, textViewResourceId, symboles);
    }

    public View getView(int position, View convertView, ViewGroup parent,
            int value) {
        View view = super.getView(position, convertView, parent);
        final TextView textView = (TextView) view
                .findViewById(android.R.id.text1);          
            textView.setText(divisions[position]);
        return view;
    }
}

我可以在模拟器中看到黑色文本(用红色四舍五入),但在平板电脑中,文本变为白色。我不知道它正在发生。无法在选项卡中进行屏幕截图,因此发布了模拟器屏幕截图。 请帮忙。

【问题讨论】:

标签: android android-spinner


【解决方案1】:

使用:

Spinner st = new Spinner(this);
st.setBackgroundColor(Color.parseColor("#fffffff0")); //Just put the color code get the color of the spinner Changed

【讨论】:

    猜你喜欢
    • 2013-08-21
    • 2011-11-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-10-21
    • 2016-09-08
    • 1970-01-01
    相关资源
    最近更新 更多