2

There are 2 best solutions below

1
Deeksha On

You can simply take Button component. But if you want to take TextView then:

    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:background="@drawable/start_btn_bg"
        android:text="start"
        android:paddingHorizontal="30dp"
        android:paddingVertical="10dp"/>

You can set background by making the custom drawable. Below is the custom drawable:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<gradient android:startColor="@color/color_red_error"
    android:centerColor="@color/color_red_error"
    android:endColor="@color/colorAccent"/>
<corners android:radius="20dp" />
0
Ric17101 On

if you wanted to have a button with rounded textView then this is how i do it. Take note, i am using com.google.android.material here to get the fastest result i wanted.

<com.google.android.material.button.MaterialButton
    android:id="@+id/button"
    android:backgroundTint="@android:color/holo_red_light"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="24dp"
    android:text="start"
    app:cornerRadius="16dp"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

This is how it looks like on my IDE.

enter image description here