Android Rounded rectangle with background color

Source: Internet
Author: User

Android Rounded Rectangle, gradient color, custom

First, write an XML in the drawable directory, with the name random (as long as the specification is met), the code is as follows:

<span style= "color: #009900;" ><span style= "Background-color:rgb (255, 255, 255); ><?xml version= "1.0" encoding= "Utf-8"? ><shape xmlns:android= "http://schemas.android.com/apk/res/ Android "    android:shape=" Rectangle ">    <gradient        android:angle=" android:startcolor= "        # 19b001 "        android:endcolor=" #19B001 "/>    <corners        android:bottomleftradius=" @dimen/dp5 "        android:bottomrightradius= "@dimen/dp5"        android:topleftradius= "@dimen/dp5"        android:toprightradius= "@ DIMEN/DP5 "/></shape></span><span style=" font-size:10px; ></span></span>

  1. Shape represents the form of graphics, mainly including squares, circles, etc., the upper code is square ,
  2. Gradient represents the primary configuration start color, end color, and middle point color, coordinates, gradient effect (0, page, gradient from left to right, top to bottom gradient) default left to right Padding represents the spacing between the top and bottom left and right of the main configuration
  3. Corners represents the radius of the configuration around the garden foot
  4. then, you are in the code or XML the layout uses it like a picture.



Android Rounded rectangle with background color

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.