onTouchListener Hover Effect
onTouchListener Hover Effect
Hover effect when you touch the view and release it. Like when I touch it the button the button text will be "TOUCHING..." and after I release it it will be "Touched, done".
Codes:
button1.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN){
// PUT YOUR CODE HERE WHEN TOUCHING, ILL PUT MINE
button1.setText("TOUCHING...");
}
if(event.getAction() == MotionEvent.ACTION_UP){
// PUT YOUR SECOND CODE HERE WHEN RELEASED
button1.setText("TOUCHED");
}
return false;
}
});
This comment has been removed by the author.
ReplyDeleteBro how can u give me game project
ReplyDelete