1. The dashed drawing effect can be done using the XML in Android.
2. Directly on the code:
<relativelayout android:id= "@+id/coupon_popup" android:layout_width= "320DP" android:layout_height= "200DP" android:layout_margin= "20DP" android:gravity = "Center_vertical" android:background= "@drawable/bg_border_stroke" >
Write a bg_border_stroke XML to do the background.
Bg_border_stroke.xml
<?xml version= "1.0" encoding= "Utf-8"? ><layer-list xmlns:android= "http://schemas.android.com/apk/res/ Android > <item> <shape> <Stroke Android:width= "1DP"Android:color= "#E8A227"/> <solid android:color= "#FFFFFF"/> <corners android:radius= "5DP"/> </shape> </item> <Item Android:bottom= "1DP"Android:left= "1DP"Android:right= "1DP"Android:top= "1DP" > <shape> <Stroke Android:dashgap= "15DP"Android:dashwidth= "15DP"Android:width= "2.5DP"Android:color= "#E8A227"/> <solid android:color= "#FFFFFF"/> <corners android:radius= "5DP"/> </shape> </item></layer-list>
You can achieve the following border effect: