2013-08-21 32 views
0

這段代碼給了我一條虛線(--------------------),但是我想要的是一個虛線行(.........................)。 下面的代碼使用列表視圖給出了一個虛線作爲行分隔符,但我想要一條虛線。 有沒有辦法實現這一點。需要在android中創建虛線而不是虛線

dotted.xml

<?xml version="1.0" encoding="utf-8"?> 

<size 
    android:height="4dp" 
    android:width="700dp"/> 

<stroke 
    android:dashWidth="3px" 
    android:color="@android:color/black" 
    android:dashGap="3px"/> 

+2

機器人:dashWidth =「1px的」 – Tombeau

+0

@Tirath但我不能增加.. – test

回答

1

以增加點的大小被設定筆劃的寬度爲相同dashWidth最簡單的方法。

<stroke 
    android:width="4dp" 
    android:dashWidth="4dp" 
    android:dashGap="8dp" 
/> 
+0

點使用此 – test

+0

嗯消失後點的大小...你是什麼意思消失?在這種情況下,您可以檢查筆畫的顏色,或者如果線條看起來像一條粗實線。 一個棘手的問題是,如果您在ICS上運行應用程序,則應該將視圖的layoutType設置爲「軟件」以正確顯示虛線。 '<查看 android:layerType =「software」 android:layout_width =「match_parent」 android:layout_height =「match_parent」/> – Chansuk

+0

使用此代碼無法看到邊框 – test