Chapter Three, setting the button border (Android)

Source: Internet
Author: User

This is done by layering several pictures to achieve the border effect.

In the Res directory under the drawable directory (no new) to build an XML file selected Layer-list.

<?xml version= "1.0" encoding= "UTF-8"? ><layer-list xmlns:android= "http://schemas.android.com/apk/res/ Android >    <!--is         related to the order. The outermost layer must be placed at the front. The innermost layer is placed inside,         otherwise it will be obscured. Also is related to the size of the value set in item-    <!--outermost-    <item>        <shape>            <solid android:color= "# 1e90ff "/>        </shape>    </item>    <!--mid-and    <item        android:bottom=" 15DP "        android:left=" 15DP "        android:right=" 15DP "        android:top=" 15DP ">        <shape>            < Solid android:color= "#ffffff"/>        </shape>    </item>    <!--innermost--    <item        android:bottom= "30DP"        android:left= "30DP"        android:right= "30DP"        android:top= "30DP" >        <shape>            <solid android:color= "#bebebe"/>        </shape>    </item></ Layer-list>
Layout file:

<linearlayout xmlns:android= "http://schemas.android.com/apk/res/android"    xmlns:tools= "http// Schemas.android.com/tools "    android:layout_width=" match_parent "    android:layout_height=" Match_parent "    tools:context= ". Mainactivity "    android:orientation=" horizontal "     >    <button        android:id=" @+id/main_button "        android:layout_width= "match_parent"        android:layout_height= "137DP"        android:background= "@drawable /buttonl "        android:text=" Button01 "/></linearlayout>
Effect:



Chapter Three, setting the button border (Android)

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.