user7805408
user7805408

Reputation:

How do I achieve the following xml layout?

Layout made by me

enter image description here

Layout I want to achieve

enter image description here

orange_hollow_fill_round_corner.xml (Custom Drawable)

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

    <corners android:radius="15dp" />

    <stroke
        android:width="1dp"
        android:color="@color/orange" />

    <size
        android:width="80dp"
        android:height="20dp" />

</shape>

enter image description here

I want to make custom drawable like shown below so that the it does not cut Earned Badges Text view.

made in paint

Please ignore differences in corner and colors of my layout and layout that I want to achieve.

Upvotes: 0

Views: 61

Answers (2)

Kishan Thakkar
Kishan Thakkar

Reputation: 459

As @noureldien mohamed way may seem viable for now but if you really want to create drawable like you mentioned you should try making vector .here is the one as per your liking.

<vector xmlns:android="http://schemas.android.com/apk/res/android" xmlns:aapt="http://schemas.android.com/aapt"
android:viewportWidth="326.33"
android:viewportHeight="76.25"
android:width="326.33dp"
android:height="76.25dp">
<path
    android:pathData="M201.13 2h109.2c7.7 0 14 6 14 13.25V61c0 7.29 -6.3 13.25 -14 13.25H16c-7.7 0 -14 -6 -14 -13.25V15.25C2 8 8.3 2 16 2h92.42"
    android:strokeColor="#FC7F2D"
    android:strokeWidth="3"
    android:strokeLineCap="round"
    android:strokeLineJoin="round" />

OUTPUT

enter image description here

Upvotes: 0

Nour Eldien Mohamed
Nour Eldien Mohamed

Reputation: 961

you can do it by just add background to textView (Earned Badges) this background has corner and black color by android:background="@drawable/your_custom_button" it will overlap on orange stork .

I hope it will help you .

Upvotes: 4

Related Questions