【问题标题】:Android Spinner drop down textcolor of selected different from the list items text color选择的 Android Spinner 下拉文本颜色与列表项文本颜色不同
【发布时间】:2014-02-05 10:53:56
【问题描述】:

我有一个微调器下拉列表,我想更改所选项目的颜色,但不更改列表项的颜色。

我想要的是使蓝色背景中的所选项目文本颜色仅为白色,其他为黑色。

【问题讨论】:

    标签: android android-spinner


    【解决方案1】:
    private OnItemSelectedListener OnCatSpinnerCL = new AdapterView.OnItemSelectedListener() {
        public void onItemSelected(AdapterView<?> parent, View view, int pos,
                long id) {
    
            ((TextView) parent.getChildAt(0)).setTextColor(Color.BLUE);
            ((TextView) parent.getChildAt(0)).setTextSize(5);
    
    
    
        }
    
        public void onNothingSelected(AdapterView<?> parent) {
    
        }
    };
    

    【讨论】:

    • 感谢它在更改字体颜色时提供了很多帮助,而不是轻微的闪烁。你有什么想法吗?
    猜你喜欢
    • 2012-04-06
    • 2014-05-15
    • 1970-01-01
    • 2012-12-14
    • 1970-01-01
    • 2023-01-12
    • 1970-01-01
    • 1970-01-01
    • 2011-11-18
    相关资源
    最近更新 更多