Sunday, February 16, 2014

Custom Button is pressed and how to write up events


Online that is all
public boolean onKeyDown (int keyCode, KeyEvent event) and
public boolean onKeyUp (int keyCode, KeyEvent event)
But I was a custom Button control keycode and I know how to control it yourself KeyEvent<-! Main posts under Banner (D4) -><-! Posts under the main text (D5) ->
Reply:
 
btn.setOnTouchListener (new OnTouchListener () {
@ Override
public boolean onTouch (View v, MotionEvent event) {
if (event.getAction () == MotionEvent.ACTION_DOWN) {
/ / Press
} Else if (event.getAction () == MotionEvent.ACTION_UP) {
/ / Bounce
}
return false;
}
});

Reply:
I also use this method, but get less bounce event

No comments:

Post a Comment