How to have EditText with border in Android Lollipop

前端 未结 5 586
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:19

    Write editTextBackground.xml in drawable folder in resources

    
        
    
    

    don't forget to declare color in resources named borderColor.

    and assign this background to the EditText in xml background attribute

    
    

    and it'll set border to EditText.

    UPDATE

    You can change border of edit text without drawable by using style attribute

    style="@style/Widget.AppCompat.EditText"
    

    for more details visit customize edit text

提交回复
热议问题