How to change the color of a button?
问题 I'm new to android programming. How do I change the color of a button? <Button android:id="@+id/btn" android:layout_width="55dp" android:layout_height="50dp" android:layout_gravity="center" android:text="Button Text" android:paddingBottom="20dp"/> 回答1: You can change the colour two ways; through XML or through coding. I would recommend XML since it's easier to follow for beginners. XML: <Button android:background="@android:color/white" android:textColor="@android:color/black" /> You can also