Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to draw multiple shapes in android drawable one after the other similar to vertical oriented Liner layout

I want to draw following shapes - Line and Circle one after the other using android drawable.Please see the attached screen-shot.

enter image description here

like image 541
Akash Bisariya Avatar asked Oct 18 '25 14:10

Akash Bisariya


1 Answers

I have find solution shown below. The gap between circle and line is achived using a hack. I just draw a stroke over the circle with white color so that it will look like a gap between the circle and line.

<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
    android:width="150dp"
    android:height="10dp"
    android:gravity="center">
    <rotate android:fromDegrees="90">
        <shape android:shape="line">
            <stroke
                android:width="2dp"
                android:color="@color/c_green_text" />
        </shape>
    </rotate>
</item>
<item
    android:width="20dp"
    android:height="20dp"
    android:gravity="center">
    <shape android:shape="oval">
        <stroke
            android:width="3dp"
            android:color="@color/c_white" />
        <solid android:color="@color/c_green_text" />
    </shape>
</item>
</layer-list>
like image 83
Akash Bisariya Avatar answered Oct 21 '25 03:10

Akash Bisariya



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!