![](/img/trans.png)
[英]How do I create a ListView with dashed / dotted line dividers in Android?
[英]dashed dividers in vertical ListView (Android)
我經歷了所有虛線分隔線主題,但是我的問題仍然存在:
我有一個垂直的LinearLayout,並希望在LinearLayout中的每個項目之間顯示虛線分隔線。 我使用以下形狀,但仍獲得一條直線。
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:color="#7b7b75"
android:dashGap="2dp"
android:dashWidth="1dp"
/>
<size android:height="1dp"/>
</shape>
請嘗試這個。
drawable/dotted.xml:
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="line">
<stroke
android:color="#C7B299"
android:dashWidth="10px"
android:dashGap="10px" />
</shape>
view.xml:
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:src="@drawable/dotted" />
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.