How to change the text background color of a opened Spinner on Android

前端 未结 1 436
不知归路
不知归路 2020-12-11 10:10

I set this XML Style in my app, but when I open a Spinner I cant see the text. This is where searching of information takes place.I don\'t really know what I am doing wrong.

1条回答
  •  粉色の甜心
    2020-12-11 10:59

    While Creating Adapter for your Spinner give custom layout instead of predefined one

    Create xml named spinner_row.xml

    
     
    

    Here you can change the color Text size and width and height of the Elements in the spinner by modifying this textview

    Use it like this while creating Adapter

     ArrayAdapter adapter=new ArrayAdapter(context, R.layout.spinner_row,yourlist);
    

    The Last task is routine

    spinner.setAdapter(adapter);
    

    I hope this will help you.

    0 讨论(0)
提交回复
热议问题