Android: Nested linear layout with different alpha value

前端 未结 5 1039
深忆病人
深忆病人 2021-01-14 12:14

I have a rectangular LinearLayout that has some margin, some round corners and an alpha value of 0.3. Inside this layout I have 4 different layouts as I display different im

5条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-14 12:57

    If you want to set the alpha only to the parent parent layout and don't want it to be translated to its child views. Use Hexadecimal color with transparency code added to it.

    Ex- Let say the background color for your Linearlayout is #FF0022 and you want to set it's opacity to 82% then add D1 to your hex code and use #D1FF0022 hex code for your viewgroup background where D1 is the parameter for the opacity of 82%

    complete list of transparency code can be found here

提交回复
热议问题