This article illustrates how the Android programming implementation changes the control's background and shape. Share to everyone for your reference, specific as follows:
1. Changing the background
Create an XML file under Res/drawable:
<?xml version= "1.0" encoding= "UTF-8"?> <selector xmlns:android=
"http://schemas.android.com/apk/res/" Android ">
//control is pressed against the background
<item android:state_pressed=" true "android:drawable=" @drawable/search_bar_ edit_pressed "/>
//control is selected background
<item android:state_selected=" true "android:drawable=" @drawable/ search_bar_edit_pressed "/>
//control background in general
<item android:drawable=" @drawable/search_bar_edit_normal " />
</selector>
2. Change Shape
<shape>
//gradient
<gradient android:startcolor= "#8600ff"/>
//stroke
<stroke android:width= "2DP" android:color= "#000000"/>
//Fillet
<corners android:radius= "5DP"/>
/margin
<padding android:left= "10DP" android:top= "10DP"
android:bottom= "10DP" android:right= "10DP"/>
</shape>
To reference on a layout file:
android:background= "@drawable/"
For more information on Android-related content readers can view the site: "Android Development Primer and Advanced Course", "Android Layout Layout Skills Summary", "Android Database Operating skills summary" and "Android Control usage Summary"
I hope this article will help you with the Android program.