通過repeat把一個圖片重復拼接在一起成一條虛線
虛線資源文件repeat_bmp_h.xml
<?xml version="1.0" encoding="utf-8"?><bitmap xmlns:android="http://schemas.android.com/apk/res/android" android:src="@drawable/repeat_h" android:tileMode="repeat" ></bitmap>其中repeat_h是虛線其中的一小段圖片,左右透明。程序中使用,只需要把repeat_bmp_h.xml設置為背景圖片即可:
<View android:id="@+id/v_curtaskitem_line" android:layout_width="188dp" android:layout_height="2dp" android:layout_below="@id/tv_curtaskitem_time" android:layout_marginTop="20dp" android:layout_alignLeft="@id/tv_curtaskitem_time" android:background="@drawable/repeat_bmp_h"/>另,豎線的話,則把圖片旋轉90度即可得到豎的虛線
新聞熱點
疑難解答