how to change the dropdown height in spinner

后端 未结 11 1629
粉色の甜心
粉色の甜心 2021-02-05 11:20

i tried a lot to change the dropdown item height of spinner.. but i couldn\'t get a good solution.. plz help me guys..

here is a code loginactivityview.xml



        
11条回答
  •  既然无缘
    2021-02-05 11:57

    Create your own textview in layout folder like this which will be populated in dropdown popup

    
    

    Note I have provided

    android:layout_height="60dp"
    

    and

    android:paddingLeft="20dp"
    

    and use this for your spinner, like this

    Spinner dropdown = (Spinner)findViewById(R.id.sosMode);
    String[] items = new String[]{"Date", "Travelling alone"};
    ArrayAdapter adapter = new ArrayAdapter(this, R.layout.custom_dropdown_list, items);
    dropdown.setAdapter(adapter);
    

    this works for me :)

提交回复
热议问题