The effect of the implementation is as follows:
The following code is the implementation of a bounding XML, very common
<?xml version= "1.0" encoding= "Utf-8"? ><shape xmlns:android= "Http://schemas.android.com/apk/res/android" > <solid android:color= "@android: color/transparent"/><stroke android:width= "1DP" android:color= "# FFFF0000 "/> <corners android:radius=" 0DP "/></shape>
Below is the XML that shows only the bottom border
<?xml version= "1.0" encoding= "Utf-8"? ><shape xmlns:android= "Http://schemas.android.com/apk/res/android" > <solid android:color= "@android: color/transparent"/><stroke android:width= "1DP" android:color= "# FFFF0000 "/> <corners android:radius=" 0DP "/></shape>
Here is the background showing the shadow effect
<?xml Version= "1.0" encoding= "Utf-8"? ><layer-list xmlns:android= "Http://schemas.android.com/apk/res/android" > <!--Bottom 2DP Shadow--<item> <shape android:shape= "Rectangle" > <solid Android Oid:color= "#BBB"/> <corners android:radius= "5dp"/> </shape> </item> <!--white Top color-to <item android:bottom= "3px" > <shape android:shape= "Rectangle" > <solid android:color= "#FFE0EEEE"/> <corners android:radius= "5DP"/> <p Adding android:top= "15DP" android:right= "15DP" android:bottom= "15DP" android:left= "15DP"/> </shape> </item></layer-list>
Click to set their background color:
public void OnClick (View v) {switch (V.getid ()) {r.id.btnshowcounttimer:new Mycounttimer (120000, +, Btnshowcount Timer). Start (); Break;case R.id.btnbgboard:btnbgboard.setbackgroundresource (R.drawable.board); break;case R.id.btnonlyshowlinebottom:btnonlyshowlinebottom.setbackgroundresource (R.drawable.board_only_bottom_line); Break;case R.id.btnshowlayers:btnshowlayers.setbackgroundresource (r.drawable.board_layers); break;default:break;}}
Set view to show only transparent bottom border, transparent background frame, shaded background box method