When we need to implement a rounded rectangle for the control or to add a border to the background, the best way to do this is not to create a background image or add ImageView as a boundary, but to use shape.
The idea is to customize a landscaping layout in the Drawable folder, the code is as follows
<?xml version= "1.0" encoding= "Utf-8"? ><shape xmlns:android= "Http://schemas.android.com/apk/res/android" > <solid android:color= "#F5F5F5"/> <stroke android:width= "2DP" android:color= "# Dcd8d8 "/> <corners android:topleftradius=" 5DP " android:toprightradius=" 5DP " android: bottomrightradius= "5DP" android:bottomleftradius= "5DP"/></shape>
Where the <stroke> tag is set the border color and width of the,<corners> can set the fillet and its radius. During the test, Android does not support the four-corner radius inconsistency.
Android How to set the rounded rectangle background of a control