1, in the Drawable folder to create a new Border.xml file, and then paste the following code, you can define the different color border according to your own needs, or only unilateral, two or three sides, four edges, very good control. 2. Refer to Border.xml on the component you need to use or the layout of layouts in background way. If you need more than one style border in your project, you can, of course, name border.xml a different file name, and then refer to it separately (pull it off, everyone is pretty bull-crossed)!
<?xml version= "1.0" encoding= "UTF-8"? ><layer-list xmlns:android= "http://schemas.android.com/apk/res/ Android > <!--border color values-- <item> <shape> <solid android:color= "#161d26"/ > </shape> </item> <!--The main background color value in item top and bottom each specify a 1DP border line--- < Item android:top= "1DP" android:bottom= "1DP" android:left= "0DP" android:right= "0DP" > <shape> < Solid android:color= "#101419"/> </shape> //Can add padding property, which is the fill area of the component's contents from the component's border <padding Android:bottom= "10DP" android:left= "10DP" android:right= "10DP" android:top= "10DP"/> </item></ Layer-list>