How do I change my Buttons color, using android:background gives it white borders?

As you probably already guessed I am quite new to coding. As my First Project i want to code TicTacToe. It seems like the default color of my Buttons is set to purple and i would like to change that. The problem is using “android:background” does nothing. If I use “android:backgroundTint” it changes the color as i want it to but i doesn´t fill the space. I appreciate every help, thanks!

<TableLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_constraintBottom_toBottomOf="parent"
        app:layout_constraintEnd_toEndOf="parent"
        app:layout_constraintStart_toStartOf="parent"
        app:layout_constraintTop_toTopOf="parent"
        app:layout_constraintVertical_bias="0.825"
        android:id="@+id/table">

        <TableRow>

            <Button
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:backgroundTint="@color/black"
                android:text="X"
                android:textSize="100dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:text="X"
                android:background="@color/white"
                android:textSize="100dp" />

            <Button
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_weight="1"
                android:text="X"
                android:background="@color/white"
                android:textSize="100dp" />

The others rows are the same

Image

Answer

The button by default is a MaterialButton component so to change the background colour you can use the attribute: android:backgroundTint and to fill the space you can use the attributes: android:insetLeft, android:insetTop, android:insetRight and android:insetBottom all to 0dp value. Also to remove the default corner radius you have to use the attribute app:cornerRadius to 0dp.

Below is an example Button which has the above attributes:

<Button
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:layout_weight="1"
   android:text="X"
   android:textSize="100sp"
   android:backgroundTint="@color/black"
   android:insetLeft="0dp"
   android:insetTop="0dp"
   android:insetRight="0dp"
   android:insetBottom="0dp"
   app:cornerRadius="0dp" />

And the Result after applying three of them horizontally with different colours and equal space will be like below:

Tictactoe