Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dragBbtn.setOnTouchListener(new View.OnTouchListener() {
- private int initialX;
- private int initialY;
- RelativeLayout.LayoutParams params= (RelativeLayout.LayoutParams) image.getLayoutParams();
- @Override
- public boolean onTouch(View v, MotionEvent event) {
- initialX = (int) image.getTranslationX();
- initialY = (int) image.getTranslationY();
- switch (event.getAction()) {
- case MotionEvent.ACTION_DOWN:
- case MotionEvent.ACTION_MOVE:
- layoutParams1.width = initialX +(int)event.getX();
- layoutParams1.height = initialY + (int)event.getY();
- image.setLayoutParams(params);
- return true;
- }
- return false;
- }
- });
Add Comment
Please, Sign In to add comment