ip696
ip696

Reputation: 7104

Try set background dashed line but result - underscore

I try set dashed line to item

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="line">

    <stroke
        android:color="#100901"
        android:dashWidth="10px"
        android:dashGap="10px"
        android:width="1dp"/>
</shape>

And in androidstudio I see all correct. But in real app I see not dashed line and underscore.

enter image description here

Upvotes: 0

Views: 36

Answers (2)

Hemant Parmar
Hemant Parmar

Reputation: 3976

You can achieve by this.

<?xml version="1.0" encoding="utf-8"?>
    <bitmap xmlns:android="http://schemas.android.com/apk/res/android"
    android:src="@drawable/triangleup"
    android:tileMode="repeat"
    android:tint="@color/lightAccent"/>

here triangleup is your image of dash line.

Happy coding!!

Upvotes: 0

SpiritCrusher
SpiritCrusher

Reputation: 21063

Use a layer-list drawable instead.

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
    android:bottom="2dp"
    android:left="-2dp"
    android:right="-2dp"
    android:top="-2dp">
    <shape>
        <solid android:color="@android:color/transparent" />
        <stroke
            android:width="1dp"
            android:color="#100901"
            android:dashGap="10px"
            android:dashWidth="10px" />
    </shape>
</item>
</layer-list>

Upvotes: 2

Related Questions