Android implements a layout or view with a top border or a border with a border or a single border

Source: Internet
Author: User

The code has a detailed explanation, there is not much to say, in the use of the direct set to background on the line

<?xml version= "1.0" encoding= "utf-8"?><!--Purpose: To give a layout up and down a border, no border around--><layer-list xmlns:android= "http:/ /schemas.android.com/apk/res/android >    <!--First define a color that fills the content area, because this color is obscured by the color of the next content area, so the first defined color is the color of the border-    <item>        <shape android:shape= "Rectangle" >            <solid android:color= "#000000"/>        </shape>    </item>    <!--    then define a color for the fill area and set the inner margin for the color to cover the background without obscuring the whole purpose     . android:top= "1DP"        android:bottom= "1DP" These two are defined below the thickness of the top and bottom border of the pading just defined the bottom spacing, optional--and    <item        android:bottom= "1DP"        android:top= "1DP" >        <shape android:shape= "Rectangle" >            < Solid android:color= "#ffffff"/>            <padding                android:bottom= "4DP"                android:left= "4DP"                android:right= "4DP"                android:top= "4DP"/>        </shape>    </item></layer-list>


Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.

Android implements a layout or view with a top border or a border with a border or a single border

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.