How to change spinner text size and text color?

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

    Make a custom XML file for your spinner item.

    spinner_item.xml:

    Give your customized color and size to text in this file.

    
    
    
    

    Now use this file to show your spinner items like:

    ArrayAdapter adapter = new ArrayAdapter(this, R.layout.spinner_item,list);
    

    You don't need to set the drop down resource. It will take spinner_item.xml only to show your items in spinner.

提交回复
热议问题