android - my ImageButton lose it's animation effect on adding background color -


whenever set android:background="colorxxx" imagebutton, effect of pressing imagebutton lost.

before adding attribute has effect filling image dark color want works when imagebutton has android:background="colorxxx"

my layout:

<?xml version="1.0" encoding="utf-8"?> <relativelayout     xmlns:android="http://schemas.android.com/apk/res/android"     xmlns:tools="http://schemas.android.com/tools"     android:layout_width="wrap_content"     android:layout_height="wrap_content"     tools:context=".homeactivity">  <linearlayout     android:orientation="horizontal"     android:layout_width="fill_parent"     android:background="@color/colorprimary"     android:layout_height="?attr/actionbarsize">      <imagebutton         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:background="@color/colorprimary"         android:src="@drawable/a"         android:layout_weight="50"         android:adjustviewbounds="true" />      <imagebutton         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:background="@color/colorprimary"         android:src="@drawable/b"         android:layout_weight="50"         android:adjustviewbounds="true" />      <imagebutton         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:background="@color/colorprimary"         android:src="@drawable/c"         android:layout_weight="50"         android:adjustviewbounds="true" />      <imagebutton         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:background="@color/colorprimary"         android:src="@drawable/d"         android:layout_weight="50"         android:adjustviewbounds="true" /> </linearlayout> 

the ripple effect part of background, android:background="?attr/selectableitembackground", if set background yourself, ripple no longer work.

you can instead change tint of button stated in this other response


Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -