How to set transparency of a background image Android xml file

后端 未结 9 696
南笙
南笙 2020-12-08 02:24

I have put an image in as the background of my android application with the following line of code:

 android:background=\"@drawable/background\"
9条回答
  •  自闭症患者
    2020-12-08 02:52

    Try to use Drawable.setAlpha();

    View backgroundImage = findViewById(R.id.background_image);
    Drawable background = backgroundImage.getBackground();
    background.setAlpha(80);
    

提交回复
热议问题