Drop shadow around all the four sides of an EditText in Android Studio

前端 未结 2 1715
[愿得一人]
[愿得一人] 2020-12-17 04:30

As far as my knowledge aids me, there isn\'t any property to drop shadow around an EditText field, that can be set in the layout file. I searched for the problem and found s

2条回答
  •  一向
    一向 (楼主)
    2020-12-17 05:05

    There are some better ways to get shadow around your edit text without using layer-list :

    #1

    Wrap your EditText in a CardView like this :

    
    
            
    
    
    

    OUTPUT :

    2

    Use a 9 patch as the background of your EditText :

        
    

    OUTPUT

    Read more about 9patch here.

    Here's a great online tool to generate 9 patch shadow.

提交回复
热议问题