Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Drawable Horizontal Line

Is it possible to make line to be like this with xml? or there's some way to do that..?

enter image description here

I already made some drawable with shape but it's not really like i want

<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle">
    <corners
        android:bottomLeftRadius="30dp"
        android:bottomRightRadius="30dp"
        android:topLeftRadius="0dp"
        android:topRightRadius="0dp" />
    <padding
        android:bottom="0dp"
        android:left="0dp"
        android:right="0dp"
        android:top="0dp" />
    <stroke
        android:width="0.8dp"
        android:color="@color/colorPrimaryDark" />
    <solid android:color="@android:color/transparent" />
</shape>
like image 596
Rizky Nofriwandi Avatar asked Sep 03 '26 11:09

Rizky Nofriwandi


1 Answers

We can create a drawable file also for this. May be helpful for someone.

Drawable file:

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">

<item>
    <shape android:shape="rectangle">
        <solid android:color="@android:color/white" />
    </shape>
</item>

<item>
    <shape android:shape="rectangle">
        <stroke
            android:width="5dp"
            android:color="@android:color/holo_blue_dark" />
        <solid android:color="@android:color/white" />
        <corners android:radius="20dp" />
    </shape>
</item>

<item android:bottom="25dp">
    <shape android:shape="rectangle">
        <stroke
            android:width="2dp"
            android:color="@android:color/white" />
        <solid android:color="@android:color/white" />
    </shape>
</item>

</layer-list>

Result :

enter image description here

like image 118
Santhosh Joseph Avatar answered Sep 04 '26 23:09

Santhosh Joseph



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!