Reputation: 23
I have started learning Android Studio and I am trying to change my button's background, but it is just not working. Here is my code:
<Button
android:layout_width="300dp"
android:layout_height="200dp"
android:text="salam"
android:textSize="30sp"
android:textColor="#ffccee"
android:background="#ffffff"
/>
The background color stays the same after I change it.
Upvotes: 2
Views: 253
Reputation: 519
So actually for some reason now Button only follows the colour which is in the theme of your activity but instead of going and messing with theme use AppCompatButton
<androidx.appcompat.widget.AppCompatButton
android:layout_width="300dp"
android:layout_height="200dp"
android:text="salam"
android:textSize="30sp"
android:textColor="#ffccee"
android:background="#ffffff">
</androidx.appcompat.widget.AppCompatButton>
Keep in mind even in future I would recommend using AppCompatButton.
Upvotes: 3