C Android StudioI have several Buttons, and I want you to see some movement when you click on them, confirming that you clicked on it Button. Is there a way to do this without creating a new file xmlin which there is selector? I would like to do something like this (I think this is the default color):
when normal
when you press
I have this, but it does nothing:
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;
}
});
source
share