ImageView imageView = findViewById(R.id.imageView); imageView.setBackgroundColor(Color.BLUE);
ImageView imageView = findViewById(R.id.imageView); imageView.setBackground(getResources().getDrawable(R.drawable.background_image));In this example, we set the background image of the ImageView using the setBackground() method. We first get the Drawable resource of the image using the getResources() method and then pass it to the setBackground() method. The package library for the ImageView class is android.widget.