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

后端 未结 5 646
借酒劲吻你
借酒劲吻你 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:31

    The answer you gave didn't exactly answer the question you asked. Here's what I did.

        Drawable login_activity_top_background = getResources().getDrawable(R.drawable.login_activity_top_background);
        login_activity_top_background.setAlpha(127);
        LinearLayout login_activity_top = (LinearLayout) findViewById(R.id.login_activity_top);
        login_activity_top.setBackgroundDrawable(login_activity_top_background);
    

提交回复
热议问题