How to change spinner text size and text color?

后端 未结 24 1984
囚心锁ツ
囚心锁ツ 2020-11-22 11:35

In my Android application, I am using spinner, and I have loaded data from the SQLite database into the spinner, and it\'s working properly. Here is the code for that.

24条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-22 12:19

    Simple and crisp...:

    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) {
    
        }
    };
    

提交回复
热议问题