How to create android spinner without down triangle on the right side of the widget

后端 未结 8 722
粉色の甜心
粉色の甜心 2020-11-27 04:59

I have a screen where the user has many items to input so screen space is at a premium.

I want the look of the widget on the screen (before the user presses it) t

8条回答
  •  萌比男神i
    2020-11-27 05:38

    One thing you can do is take Spinner's source code from android code base, together with related layouts and resources, and use them to create your own custom widget (probably you will only need to remove the arrow from the layout and tweak the code a little depending on your needs).

    EDIT: You're right, following that post it was actually really simple :) You have to do two things. First, create a styles.xml file under res/values, open it and add the following:

    
    
        
    
    

    Next, in your layout, add the Spinner like this:

    
    

    That's it, now the spinner will look like a plain EditText, without that unuseful and annoying down arrow.

提交回复
热议问题