Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simulate click effect on transparent button [duplicate]

Possible Duplicate:
ImageButton doesn’t highlight on click with Transparent background

I have made a custom bar where I have buttons with the attribute

        android:background="@android:color/transparent"

My problem is that when I click on the buttons the click effect does not trigger(in this case the button should become and blue and fade back in its original color -transparent here-).

How do I enable it or just simulate the effect? Any ideas?

like image 917
MayTheSchwartzBeWithYou Avatar asked Oct 14 '12 11:10

MayTheSchwartzBeWithYou


2 Answers

Seems transparent is a bad option. Better have

style="?android:attr/borderlessButtonStyle"

same effect, without needing to go through creating another custom xmls

like image 192
MayTheSchwartzBeWithYou Avatar answered Nov 03 '22 01:11

MayTheSchwartzBeWithYou


You need to use selector check: http://developer.android.com/guide/topics/ui/controls/button.html under "Custom background"

like image 23
TOMKA Avatar answered Nov 03 '22 02:11

TOMKA