繁体   English   中英

垂直ListView中的虚线分隔线(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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM