How to show a textview with rounded corner rectangle as shown in the orginal image
in the above (original) picture, the button 2's left and right rounded corner are correctly shaped but in my code the left and right rounded corners are not shaped correctly
in the second picture I need to do more rounded as the 1st image. how can I do with following drawable?
drawable code (green_bg.xml)
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#19D8C8" />
<corners android:radius="3dip" />
<stroke
android:width="10dp"
android:color="#19D8C8" />
</shape>
activity_main.xml
.......
<TextView
android:id="@+id/qmap_2"
android:layout_width="35dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:gravity="center"
android:text="2"
android:textStyle="bold"
android:textColor="@color/no_color" />
......
create a file round.xml in drawable
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#176d7a" />
<corners android:radius="50dp" />
</shape>
now set the background of textview like
<TextView
android:id="@+id/qmap_2"
android:layout_width="35dp"
android:layout_height="24dp"
android:layout_gravity="center_vertical"
android:gravity="center"
android:text="2"
android:textStyle="bold"
android:background="@drawable/round"
android:textColor="@color/no_color" />
it should work
Change the corner radius to a much higher value i.e 100dp
<corners android:radius="100dip" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With