The easiest way to solve this is to set the transparency of the Fragment in the XML.
You can define a transparent color in colors.xml
like this:
<color name="transparent">#00000000</color>
and then reference it in your fragment.xml like this: android:backgroundTint="@color/transparent"
Additionally its advisable, to set View-Altering commands into the onCreate()
.
Also you can define an android:alpha="0"
attribute in the .xml
to test if that will set the background color to transparent. But I guess this will only change the opacity of the whole fragment including child elements.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…