Button effect pressed

Asked

Viewed 551 times

1

I have several buttons on an app and wanted them to have the same effect as Button when pressed, because there are several buttons, I would like to create a code in JAVA for this and not by the method of States in XML, as it would have to create dozens of sprites different. I saw something about using setOnTouchListener with the setColorFilter, some light?

  • setbackground does not resolve?

  • What would be the effect? Has how to describe better?

  • 1

    <android button:text="button" android:backgroung="? attr/selectableItemBackground"/> This works. I believe if you do the same, via java code, it will work. I am not in a condition to test now but it should work yes.

  • Exactly, I found out just before you comment here, but still, thank you very much!

1 answer

1


I found what I wanted, would be the selectableItemBackgroundBorderless or as the colleague above spoke attr/selectableItemBackground, just put in the background of Imagebutton.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.