垂直ListView(Android)中的虚线分隔线

时间:2013-02-13 12:58:23

标签: android xml android-linearlayout divider dotted-line

我经历了所有破碎的分频器主题alrady,但不知怎的,我的问题仍然存在:

我有一个垂直的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>

1 个答案:

答案 0 :(得分:0)

请试一试。

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" />
相关问题