I am try to set image background . I am creating a View that’s background color is red .
All view and set image background programmatically .
this is my code
final View trans_View = new ImageView(MyClass.this);
ImageView img = (ImageView)findViewById(R.id.img);
LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
100, 100);
params.setMargins(10, 2, 10, 2);
trans_View.setBackgroundColor(Color.RED);
trans_View.setLayoutParams(params);
img.setBackground View ????
example-
Actual image :

when i select Image then display below output.
I don’t know how to set view as image background .
Please help me…
It is not possible.
If you just need to add background to your
ImageViewusesetBackgroundColor(Color.RED).Or if you’re really need to use
Viewas a background, you can useFrameLayout:However this is not recomended, since there will be unneccecary overdraw.