I have some problem. I try to show on the screen background with picture on it. My background is in the
<ImageView
android:id="@+id/imageView1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true"
android:scaleType="fitXY"
android:src="@drawable/ic_nebo" />
end i show it on the screen
setContentView(R.layout.background);
But my secon picture, that i need to shown is in class extends SurfaceView
public class GameView extends SurfaceView
{
/**Загружаемая картинка*/
private Bitmap bmp;
/**Наше поле рисования*/
private SurfaceHolder holder;
//конструктор
public GameView(Context context)
{
super(context);
holder = getHolder();
holder.addCallback(new SurfaceHolder.Callback()
{
public void surfaceDestroyed(SurfaceHolder holder)
{
}
@Override
public void surfaceCreated(SurfaceHolder holder)
{
Canvas canvas = holder.lockCanvas(null);
onDraw(canvas);
holder.unlockCanvasAndPost(canvas);
}
@Override
public void surfaceChanged(SurfaceHolder holder, int format, int width, int height)
{
}
});
bmp = BitmapFactory.decodeResource(getResources(), R.drawable.soldat);
}
//Рисуем нашу картинку на черном фоне
protected void onDraw(Canvas canvas)
{
canvas.drawColor(Color.WHITE);
canvas.drawBitmap(bmp, 10, 10, null);
}
}
and I try to put it on the screen by
setContentView( new GameView(this));
but I but I already have setContentView
method
How I can draw this two picture, one from xml file and another from class setContentView
in simultaneously?