Skip to content

Instantly share code, notes, and snippets.

@jab416171
Created January 29, 2014 05:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jab416171/8682613 to your computer and use it in GitHub Desktop.
Save jab416171/8682613 to your computer and use it in GitHub Desktop.
public class DrawingPanel extends SurfaceView implements SurfaceHolder.Callback {
private final Drawable mCustomImage;
@Override
public void onDraw(Canvas canvas) {
super.onDraw(canvas);
mCustomImage.setBounds(new Rect(0, 0, 50, 50));
mCustomImage.draw(canvas);
}
private PanelThread _thread;
public DrawingPanel(Context context) {
this(context, null);
}
public DrawingPanel(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public DrawingPanel(Context context, AttributeSet attrs, int defStyle) {
super(context, attrs, defStyle);
mCustomImage = context.getResources().getDrawable(R.drawable.ic_launcher);
getHolder().addCallback(this);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment