Issue
This is my rounded button's codes. It is in the drawable file.
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:padding="10dp"
android:shape="rectangle">
<solid android:color="@color/teal_200"/>
<corners android:radius="100dp"/>
</shape>
And that is my activiy_main.xml
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<Button
android:id="@+id/btnRnd"
android:layout_width="200dp"
android:layout_height="65dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginTop="272dp"
android:background="@drawable/round_btn"
android:gravity="center"
android:text="Click Me"
android:textSize="30sp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0.497"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
There is no problem about shape btw it becomes rounded but Normally my button color must be teal_200 which is turquoise but when it show up on the design it looks default color like ı did not assign any color.
Solution
android:backgroundTint="@null"
app:backgroundTint="@null"
Add these lines to the xml code of the button.
Answered By - ADITYA RANADE
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.