Does anyone know how to change the color of a button?
but one specific button, and not all application buttons using XML.
The android: backgroundTint attribute does not work on pre-Lollipop even with the AppCompat library. Only colorButtonNormal from the theme runs on pre-candy.
It's true? what a disgrace
I use this drawable (plain green color) with a button, but when I use a button, it turns out to be higher than a regular button.
this is the btn_green.xml file
<?xml version="1.0" encoding="utf-8"?>
<item android:state_pressed="true"><shape> <solid android:color="#ff5722" /> <corners android:radius="4dp" /> </shape></item> <item android:state_focused="true"><shape android:shape="rectangle"> <solid android:color="#4caf50" /> <corners android:radius="4dip" /> <stroke android:width="1dip" android:color="#F0FC00" /> </shape></item> <item><shape> <solid android:color="#4caf50" /> <corners android:radius="4dp" /> </shape></item>
button:
<android.support.v7.widget.AppCompatButton android:id="@+id/btnIngresar" android:layout_width="fill_parent" android:layout_height="wrap_content" android:background="@drawable/btn_green" android:text="Hello" android:textStyle="bold" />
when I use drawable, the button is higher than usual (without drawing), I donโt know why.
source share