1
我想在點擊的地方繪製圖像。我有這樣的代碼:Android和繪畫圖像
public class CanvasdrawActivity extends Activity {
ImageView picture;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
picture=(ImageView) findViewById(R.id.imageView1);
picture.setImageResource(R.drawable.star_bez_nog);
picture.setOnTouchListener(new OnTouchListener() {
@Override
public boolean onTouch(View v, MotionEvent event) {
if(event.getAction() == MotionEvent.ACTION_DOWN){
int x = (int) event.getX() ;
int y = (int) event.getY() ;
}
return true;
}
});
}
}
如何從資源中繪製圖片?