0
我有一個ImageView子類,應該在顯示圖像的底部顯示一個標誌。我有這個onDraw代碼在圖像上繪製圖標。它在ICS +上工作正常,但沒有降低。有誰知道這個的原因?Android Canvas繪圖不一致
@Override
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
int canvasHeight = canvas.getHeight();
int canvasWidth = canvas.getWidth();
Drawable icon = getResources().getDrawable(R.id.icon);
int width = icon.getIntrinsicWidth();
int height = iconcon.getIntrinsicHeight();
int x = canvasWidth - width - PADDING;
int y = canvasHeight - height - PADDING;
icon.setBounds(x, y, canvasWidth - PADDING, canvasHeight - PADDING);
icon.draw(canvas);
}
所以在較低版本,它會給出任何錯誤? –