In many android applications, we often see the text editing box with rounded corners. How is that implemented?
Two shape drawing files are required.
For the top EditText, call this, top_edittext_bg:
[Javascript]
01. <? Xml version = "1.0" encoding = "UTF-8"?>
02. <shape xmlns: android = "http://schemas.android.com/apk/res/android"
03. android: shape = "rectangle">
04.
05. <solid
06. android: color = "# e2e2e2">
07. </solid>
08.
09. <corners
10. android: radius = "1dp"
11. android: bottomLeftRadius = "0.1dp"
12. android: bottomRightRadius = "0.1dp"
13. android: topLeftRadius = "5dp"
14. android: topRightRadius = "5dp">
15. </corners>
16.
17. </shape>
<? Xml version = "1.0" encoding = "UTF-8"?>
<Shape xmlns: android = "http://schemas.android.com/apk/res/android"
Android: shape = "rectangle">
<Solid
Android: color = "# e2e2e2">
</Solid>
<Corners
Android: radius = "1dp"
Android: bottomLeftRadius = "0.1dp"
Android: bottomRightRadius = "0.1dp"
Android: topLeftRadius = "5dp"
Android: topRightRadius = "5dp">
</Corners>
</Shape>
For the EditText in the middle, call this, bottom_edittext_bg:
[Javascript]
01. <? Xml version = "1.0" encoding = "UTF-8"?>
02. <shape xmlns: android = "http://schemas.android.com/apk/res/android"
03. android: shape = "rectangle">
04.
05. <solid
06. android: color = "# e2e2e2">
07. </solid>
08.
09. <corners
10. android: radius = "1dp"
11. android: bottomLeftRadius = "5dp"
12. android: bottomRightRadius = "5dp"
13. android: topLeftRadius = "0.1dp"
14. android: topRightRadius = "0.1dp">
15. </corners>
16.
17. </shape>
<? Xml version = "1.0" encoding = "UTF-8"?>
<Shape xmlns: android = "http://schemas.android.com/apk/res/android"
Android: shape = "rectangle">
<Solid
Android: color = "# e2e2e2">
</Solid>
<Corners
Android: radius = "1dp"
Android: bottomLeftRadius = "5dp"
Android: bottomRightRadius = "5dp"
Android: topLeftRadius = "0.1dp"
Android: topRightRadius = "0.1dp">
</Corners>
</Shape> then set this attribute in android: background = "@ drawable/RESPECTIVE_XMLS" to the associated EditText's