Opacity on a background Drawable image in View (using XML Layout)

后端 未结 5 651
借酒劲吻你
借酒劲吻你 2021-01-01 10:57

I was just wondering if there was a way to change the opacity of the background image for a View (ie. TextView, etc.).

I know that I can se

5条回答
  •  无人及你
    2021-01-01 11:40

    You can embed the image in xml, so you'll be able to see it in the Graphical Layout

    
    

    And change the code like this to make it transparent:

    Drawable loginActivityBackground = findViewById(R.id.login_layout).getBackground();
    loginActivityBackground.setAlpha(127);
    

提交回复
热议问题