How to change spinner text size and text color?

后端 未结 24 2122
囚心锁ツ
囚心锁ツ 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:29

    Try this method. It is working for me.

    @Override
    public void onItemSelected(AdapterView adapterView, View view, int i, long l) {
        TextView textView = (TextView) view;
        ((TextView) adapterView.getChildAt(0)).setTextColor(Color.RED);
        ((TextView) adapterView.getChildAt(0)).setTextSize(20);
        Toast.makeText(this, textView.getText()+" Selected", Toast.LENGTH_SHORT).show();
    }
    

提交回复
热议问题