如何在画布中显示视图

时间:2011-12-26 18:37:08

标签: android view canvas

我尝试创建自己的视图并尝试在其中添加按钮或TextView。

public class Test extends View{
Button _button;

public Test(Context context) {
    super(context);
    _button = new Button(getContext());
}

@Override
protected void onDraw(final Canvas canvas) 
{
    super.dispatchDraw(canvas);
        canvas.drawBitmap(BitmapFactory.decodeResource(getContext().getResources(), R.drawable.ic_launcher), 100, 100, new Paint());
}

}

那么如何在画布中显示这个按钮,就像这个Bitmap一样?

感谢。

0 个答案:

没有答案