にして表示する
import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.os.Bundle;
import android.view.View;
public class BitmapTest extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
BitmapView view = new BitmapView(this.getApplication());
setContentView(view);
}
}
class BitmapView extends View {
private Bitmap bmp;
public BitmapView(Context context) {
super(context);
setFocusable(true);
bmp = BitmapFactory.decodeResource(this.getResources(), R.drawable.bmptest1);
}
protected void onDraw(Canvas canvas) {
canvas.drawColor(Color.WHITE);
canvas.drawBitmap(bmp, 0, 0, null);
}
}
0 件のコメント:
コメントを投稿