public class CumtomView extends View {
private int lastX;
private int lastY;
public CumtomView(Context context) {
super(context);
}
public CumtomView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
}
public CumtomView(Context context, @Nullable AttributeSet attrs,int defStyle) {
super(context, attrs,defStyle);
}
@Override
public boolean onTouchEvent(MotionEvent event) {
int x= (int) event.getX();
int y= (int) event.getY();
switch (event.getAction()){
case MotionEvent.ACTION_DOWN:
lastX=x;
lastY=y;
break;
case MotionEvent.ACTION_MOVE:
int offsetX= x-lastX;
int offsetY= y-lastY;
layout(getLeft()+offsetX,getTop()+offsetY,getRight()+offsetX,getBott
1.layoutpublic class CumtomView extends View { private int lastX; private int lastY; public CumtomView(Context context) { super(context); } public CumtomView(Context co...