Advertisement
Ankhwatcher

Pop in button

Jul 2nd, 2014
278
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.92 KB | None | 0 0
  1.   ivAdd.setOnTouchListener(new View.OnTouchListener() {
  2.                 @Override
  3.                 public boolean onTouch(View view, MotionEvent motionEvent) {
  4.                     switch (motionEvent.getAction()) {
  5.                         case MotionEvent.ACTION_DOWN:
  6.                             if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT)
  7.                                 ivAdd.setElevation(0);
  8.                             break;
  9.                         case MotionEvent.ACTION_UP:
  10.                         case MotionEvent.ACTION_CANCEL:
  11.                         case MotionEvent.ACTION_OUTSIDE:
  12.                             if (Build.VERSION.SDK_INT > Build.VERSION_CODES.KITKAT)
  13.                                 ivAdd.setElevation(TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 5, getResources().getDisplayMetrics()));
  14.  
  15.                     }
  16.                     return false;
  17.                 }
  18.             });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement