Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to define a rectangle with a circle at the end using Android XML definitions

Is it possible to define a shape like shown on the following image:

rectangle ending in a circle

I tried a layer-list but I could not find a solution close to what I am looking for.

I want to use the resulting shape as a background image to a RelativeLayout with a transparency.

Any hints are appreciated! Thank you.

like image 991
OpenHaus Avatar asked Oct 20 '25 03:10

OpenHaus


1 Answers

Here is the shape you asked for:

<?xml version="1.0" encoding="UTF-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item>
    <shape android:shape="rectangle">
        <size 
            android:width="250dp"
            android:height="100dp" />
        <solid android:color="#ffffff" />
    </shape>
</item>

<item
    android:top="0dp">
    <shape android:shape="line">
        <stroke
            android:width="25dp"
            android:color="#000000" />
    </shape>
</item>

<item
    android:right="0dp"
    android:left="150dp">
    <shape android:shape="oval">
        <solid android:color="#000000" />
    </shape>
</item>
</layer-list>

Screenshot:

enter image description here

like image 133
Onik Avatar answered Oct 22 '25 06:10

Onik