Android Development Draw Fillet Background Implementation program

Source: Internet
Author: User

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>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.