Вот код игры "крестики нолики".  Кнопки imageButtonSound и imageButtonMusic не видно. Возможно они отрисовываются перед крестиками-ноликами. Как решить проблему?
package com.example.lab4;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.widget.ImageButton;
import android.widget.TextView;

public class MainActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(new DrawView(this));
        //setContentView(R.layout.activity_main);
        /*
        ImageButton imageButtonMusic = findViewById(R.id.imageButtonMusic);
        ImageButton imageButtonSound = findViewById(R.id.imageButtonSound);

        final boolean[] isSoundOn = {true};


        imageButtonMusic.setOnClickListener(v -> {
            if (isSoundOn[0]) {
                imageButtonMusic.setImageResource(R.drawable.no_music);
                isSoundOn[0] = false;
            } else {
                imageButtonMusic.setImageResource(R.drawable.music);
                isSoundOn[0] = true;
            }
        });
        imageButtonSound.setOnClickListener(v -> {
            if (isSoundOn[0]) {
                imageButtonSound.setImageResource(R.drawable.no_sound);
                isSoundOn[0] = false;
            } else {
                imageButtonSound.setImageResource(R.drawable.sound);
                isSoundOn[0] = true;
            }
        });
*/

    }
}

class DrawView extends View {
    static Game game = new Game();
    Paint p = new Paint();

    public DrawView(Context context) {
        super(context);
    }

    @Override
    protected void onDraw (Canvas canvas){
        canvas.drawColor(Color.WHITE);//заливка фона
        DisplayMetrics displaymetrics = getResources().getDisplayMetrics();//получим размер экрана
        int w = displaymetrics.widthPixels;
        int h = displaymetrics.heightPixels;

        // настройка кисти
        p.setColor(Color.BLUE);
        p.setStrokeWidth(10);

        //рисуем линии
        canvas.drawLine(0, w / 3, w, w / 3, p);
        canvas.drawLine(0, 2 * w / 3, w, 2 * w / 3, p);
        canvas.drawLine(w / 3, 50, w / 3, w, p);
        canvas.drawLine(2 * w / 3, 50, 2 * w / 3, w, p);


        for(int i=0;i<3;i++)
            for(int j=0;j<3;j++)
                if(game.get(i,j)==1) DrawPic1( canvas, 50+i*w/3, 50+j*w/3);
                else if(game.get(i,j)==2) DrawPic2( canvas, 50+i*w/3, 50+j*w/3);

        String s = new String();
        int stat=game.check();

        p.setColor(Color.BLUE);

        if (stat == 4 && game.getPlayer() == 2) canvas.drawLine(1*w/18,1*w/6, 17*w/18,1*w/6,p);
        if (stat == 5 && game.getPlayer() == 2) canvas.drawLine(1*w/18,3*w/6, 17*w/18,3*w/6,p);
        if (stat == 6 && game.getPlayer() == 2) canvas.drawLine(1*w/18,5*w/6, 17*w/18,5*w/6,p);

        if (stat == 1 && game.getPlayer() == 2) canvas.drawLine(1*w/6,1*w/18, 1*w/6,17*w/18,p);
        if (stat == 2 && game.getPlayer() == 2) canvas.drawLine(3*w/6,1*w/18, 3*w/6,17*w/18,p);
        if (stat == 3 && game.getPlayer() == 2) canvas.drawLine(5*w/6,1*w/18, 5*w/6,17*w/18,p);

        if (stat == 7 && game.getPlayer() == 2) canvas.drawLine(1*w/18,1*w/18, 17*w/18,17*w/18,p);
        if (stat == 8 && game.getPlayer() == 2) canvas.drawLine(17*w/18,1*w/18, 1*w/18,17*w/18,p);

        if (stat == 4 && game.getPlayer() == 1) canvas.drawLine(1*w/18,1*w/6, 17*w/18,1*w/6,p);
        if (stat == 5 && game.getPlayer() == 1) canvas.drawLine(1*w/18,3*w/6, 17*w/18,3*w/6,p);
        if (stat == 6 && game.getPlayer() == 1) canvas.drawLine(1*w/18,5*w/6, 17*w/18,5*w/6,p);

        if (stat == 1 && game.getPlayer() == 1) canvas.drawLine(1*w/6,1*w/18, 1*w/6,17*w/18,p);
        if (stat == 2 && game.getPlayer() == 1) canvas.drawLine(3*w/6,1*w/18, 3*w/6,17*w/18,p);
        if (stat == 3 && game.getPlayer() == 1) canvas.drawLine(5*w/6,1*w/18, 5*w/6,17*w/18,p);

        if (stat == 7 && game.getPlayer() == 1) canvas.drawLine(1*w/18,1*w/18, 17*w/18,17*w/18,p);
        if (stat == 8 && game.getPlayer() == 1) canvas.drawLine(17*w/18,1*w/18, 1*w/18,17*w/18,p);


        if(stat!=0 &&stat!=9&& game.getPlayer()==2) s="Победа первого игрока";
        if(stat!=0 &&stat!=9&& game.getPlayer()==1) s="Победа второго игрока";
        if(stat==9 ) s="Ничья";

        if (stat==1) canvas.drawLine(2*w/6,2*w/6, 5*w/6,2*w/6,p);


        p.setTextSize(50);
        canvas.drawText(s, 10, 3*w/3+50, p);
    }

    public void DrawPic1(Canvas canvas, int x, int y) {
        Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.sound);
        canvas.drawBitmap(bitmap, x-50, y-50, p);
    }
    public void DrawPic2(Canvas canvas, int x, int y) {
        Bitmap bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.p2);
        canvas.drawBitmap(bitmap, x-50, y-50, p);
    }

    public boolean onTouchEvent(MotionEvent event) {
        if (game.isEnded()) return true;

        // координаты Touch-события
        float X = event.getX();
        float Y = event.getY();
        DisplayMetrics displaymetrics = getResources().getDisplayMetrics();//получим размер экрана
        int w = displaymetrics.widthPixels;
        int h = displaymetrics.heightPixels;
        int i = 0, j = 0;
        if (X >= 0 && X <= w / 3) i = 0;
        if (X >= w / 3 + 10 && X <= 2 * w / 3 + 10) i = 1;
        if (X >= 2 * w / 3 + 20) i = 2;
        if (Y >= 0 && Y <= w / 3) j = 0;
        if (Y >= w / 3 + 10 && Y <= 2 * w / 3 + 10) j = 1;
        if (Y >= 2 * w / 3 + 20) j = 2;
        if (game.get(i, j) == 0) {
            game.set(i, j);
            game.change_player();
            invalidate();
        }
        return true;
    }
}

class Game {
    boolean ended = false;
    int [][] a = {{0,0,0}, {0,0,0}, {0,0,0}};
    int player=1; // игрок, делающий ход

    public boolean isEnded() {
        return this.ended;
    }
    public void set(int i, int j) {
        a[i][j] = player;
    }
    public int get(int i, int j) {
        return a[i][j];
    }
    public void change_player() {
        if (player==1) player=2; else player=1;
    }
    public int getPlayer(){ return player;}
    public int check() {
        int state=0;
        if(a[0][0]!=0 && a[0][0]==a[0][1] && a[0][1]==a[0][2])state =1; else
        if(a[1][0]!=0 && a[1][0]==a[1][1] && a[1][1]==a[1][2])state =2; else
        if(a[2][0]!=0 && a[2][0]==a[2][1] && a[2][1]==a[2][2])state =3; else
        if(a[0][0]!=0 && a[0][0]==a[1][0] && a[1][0]==a[2][0])state =4; else
        if(a[0][1]!=0 && a[0][1]==a[1][1] && a[1][1]==a[2][1])state =5; else
        if(a[0][2]!=0 && a[0][2]==a[1][2] && a[1][2]==a[2][2])state =6; else
        if(a[0][0]!=0 && a[0][0]==a[1][1] && a[1][1]==a[2][2])state =7; else
        if(a[0][2]!=0 && a[0][2]==a[1][1] && a[1][1]==a[2][0])state =8; else
        if(a[0][0]*a[0][1]*a[0][2]*a[1][0]*a[1][1]*a[1][2]*a[2][0]*a[2][1]*a[2][2]!=0)
            state=9; //ничья

        if (state!=0) this.ended = true;

        return state;
    }
}