WISHY
WISHY

Reputation: 11999

How can I make this type of draw-able shape, android?

I need to make this shape in android using the shape xml

enter image description here

The shape needs to be in rectangle shape with round corners at top left and top right leaving the bottom corners as it is.

I tried the following but not working

    <?xml version="1.0" encoding="utf-8"?>
    <shape xmlns:android="http://schemas.android.com/apk/res/android"
     android:shape="rectangle" >
    <corners
    android:topLeftRadius="10dp"
    android:topRightRadius="10dp" 
      />
    <gradient
    android:angle="270"
    android:endColor="@color/Red"
    android:startColor="@color/Red"
    android:type="linear" />
    </shape>

Upvotes: 3

Views: 633

Answers (2)

M D
M D

Reputation: 47807

set <corners> like in XML

<corners 
   android:radius="1dp" 
   android:topLeftRadius="10dp" 
   android:topRightRadius="10dp" 
   android:bottomLeftRadius="0dp"    
   android:bottomRightRadius="0dp"/>

Upvotes: 1

Ammar ali
Ammar ali

Reputation: 1503

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

    <solid android:color="#ff0000" />

    <corners
       android:topLeftRadius="4dp"
        android:topRightRadius="4dp" />

    <padding
        android:bottom="5dip"
        android:left="10dip"
        android:right="10dip"
        android:top="5dip" />

</shape>

Upvotes: 4

Related Questions