How to have EditText with border in Android Lollipop

前端 未结 5 583
Happy的楠姐
Happy的楠姐 2020-12-08 03:56

I am developing an Android app. I need to know how we can have a EditText with border. In Lolipop they have completely changed the EditText style. Can we do it without using

5条回答
  •  醉话见心
    2020-12-08 04:39

    A quick and dirty solution I have used is to place the EditText inside of a FrameLayout. The margins of the EditText control the thickness of the border and the border color is determined by the background color of the FrameLayout.

    Example:

    
    
        
    
    

    But I would recommend, and the vast majority of the time I do, drawables for borders. Elite's answer is what I would go for in that case.

提交回复
热议问题