How can I do that?
how can I add button in Textview-android studio layout editor
106 Views Asked by John Han At
2
There are 2 best solutions below
0
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.

You can simply take
Buttoncomponent. But if you want to takeTextViewthen:You can set background by making the custom drawable. Below is the custom drawable: