0
我有一个custom ImageView
,我可以绘制,缩放和绘制点(坐标)。我需要使用按钮刷新imageView(无效不起作用)
I have a button "reset" which delete the coordinates i draw
但是我的imageView不会刷新,当我点击它后刷新,当我触摸屏幕。
会看到一些代码
这里buttons- btnRes
的onClick
是按钮我需要帮助!
//this method is on the "Main extends Activity"
public void onClick(View v) {
switch(v.getId()){
case R.id.btnFin:
break;
case R.id.btnInv:
break;
case R.id.btnRes://start over
Imagen.listaPtos.clear();
//refreshing image
imagen.invalidate();//dont works
imagen.refreshDrawableState();//dont works neither
break;
}
}
约我班imagen画质一些事情代码
public class Imagen extends ImageView
static ArrayList <Marking> listaPtos = new ArrayList<Marking>();
一些代码取自imagen
@Override
public void onDraw(Canvas c){
Log.d("onDraw","pinta="+pinta);
c.drawBitmap(bitmap, matrix, paintFondo);
if(listaPtos!=null){
for(Marking mark:listaPtos){
c.drawBitmap(cruz, mark.x, mark.y, paintPuntos);
}
}
}
//for coordinates
class Marking{
int x;
int y;
Marking(int x, int y){
this.x = x;
this.y = y;
}
Marking(){}
int getX(){
return x;
}
int getY(){
return y;
}
void setX(int x){
this.x = x;
}
void setY(int y){
this.y = y;
}
}
任何想法后,明白了?
postInvalidate()不工作也不:/ – 2014-10-29 12:13:20
图像。 onDraw(新的画布)也不工作 – 2014-10-29 12:15:15