最近要实现橡皮擦功能 当手指按下时 出现图片,手指移动的过程中,图片随着移动的需求,这样就需要在RelativeLayout中动态添加图片,然后OnTouchEvent事件中,来处理移动事件
具体代码如下:
1.动态添加ImageView;
布局文件:
private RelativeLayout main_area;
main_area=(RelativeLayout)findViewById(R.id.main_area);
2.添加Imagview
private void addEraserImage(int left,int top,int right,int bottom){
Image eraser_img=new ImageView(this