With Android Studio
I have some Buttons
and I want that when I click on them you can see a kind of movement that confirm you have clicked that Button
. Is there a way to do that without create a new xml
file in which there is a selector
?
I'd like to do something like that (I think it's default color):
when is normal
when is pressed
I have this but It doesn't do anything:
Button b = (Button)findViewById(R.id.btn);
b.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if (event.getAction() == MotionEvent.ACTION_DOWN ) {
return true;
}
return false;
}
});