public boolean onTouch(View v, MotionEvent me) { // TODO Auto-generated method stub if (me.getAction() == MotionEvent.ACTION_DOWN){ float oldXvalue = me.getX(); float oldYvalue = me.getY(); Log.i("myTag", "Action UP " + oldXvalue + "," + oldYvalue); } else if (me.getAction() == MotionEvent.ACTION_UP) { if ( btn.hasFocus()) { btn.setFocusableInTouchMode(true); btn.requestFocus(); btn.setText("Focus"); } } else if (me.getAction() == MotionEvent.ACTION_MOVE ){ LayoutParams params = new LayoutParams(v.getWidth(), v.getHeight(), (int)(me.getRawX() - (v.getWidth() / 2)), (int)(me.getRawY() - (v.getHeight()))); v.setLayoutParams(params); } return true; } });
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)