Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- detect touched item changed without lifting up finger (swipe)
- gridview.setOnTouchListener(new OnTouchListener(){
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- if(event.getAction() == MotionEvent.ACTION_MOVE){
- gridview.requestFocusFromTouch();
- gridview.setSelection(gridview.pointToPosition((int)event.getX(),(int)event.getY()));
- return true;
- }
- if(event.getAction() == MotionEvent.ACTION_UP){
- gridview.clearFocus();
- return true;
- }
- return false;
- }
- });
Add Comment
Please, Sign In to add comment