The
requires a rounded background, but a picture with a rounded angle, but because the Android screen resolution is too messy, in order to adapt to all the resolution, we can not determine the good width, although the use of draw9patch, but I have not mastered the use of the tool, The resulting image is eventually distorted, but the following method will never deform, because no pictures are used to directly draw with Android.
Final effect diagram:
Create a new drawable XML file, called SERVER_SETTING_BG:
code is as follows |
copy code |
<?xml Version= "1.0" encoding= "Utf-8" <shape xmlns:android= "Http://schemas.android.com/apk/res/android" > <!--width and color of the edge line; <stroke android:width= "1px" android:color= " #7d7a7a "/> <!--in the middle of the background color; <solid android:color=" #e4e4e4 "/ <!--set angle of four angles; <corners android:topleftradius= "10DP" Android: toprightradius= "10DP" android:bottomleftradius= "10DP" android:bottomrightradius= "10DP"/> </shape> |
Call Method:
The code is as follows |
Copy Code |
<linearlayout Android:layout_width= "Fill_parent" android:layout_height= "300DP" android:layout_marginleft= "10DP" android:layout_marginright= "10DP" android:layout_margintop= "20DP" android:background= "@drawable/SERVER_SETTING_BG" android:orientation= "Vertical" > </LinearLayout> |