I want to make my button narrowed or back to normal before it was set with background.
I know using background tint will work on this with same background color but my problem is I am using a selector on background. When selector is set to button background, it became wider. When I switched background to backgroundtint, the color become different (e.g. for me is violet) and it is not changing color on pressed. Padding are not working as work around by setting the negative values nor positive values. What else can I do ? My goal is my button will change color when clicked but it's height is narrow/default size like in wrap content.
Here is my sample code of the button
<Button
android:text="Add"
android:fontFamily="@string/fontFamily"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:id="@+id/btnInformantsAdd"
android:gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/textSizeCommon"
android:background="@drawable/ButtonSelectorBlue"
android:paddingTop="-10dp"
android:paddingBottom="-10dp"
android:layout_gravity="center"
android:layout_marginTop="@dimen/marginTop1"
android:layout_marginBottom="@dimen/marginTop1" />
Selector XML Code
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_pressed="true">
<layer-list>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/bluegreendark_light" />
<padding android:left="10dp"
android:top="@dimen/paddingSide1"
android:right="10dp"
android:bottom="@dimen/paddingSide1"/>
<corners android:radius="5dp" />
</shape>
</item>
</layer-list>
</item>
<item android:state_pressed="false">
<layer-list>
<item>
<shape android:shape="rectangle">
<solid android:color="@color/bluegreendark"/>
<padding android:left="0dp"
android:top="0dp"
android:right="0dp"
android:bottom="0dp"/>
<corners android:radius="5dp" />
</shape>
</item>
</layer-list>
</item>
</selector>