I have a few textviews inside a linear layout, but when i set the alpha property in linear layout, even the child layouts appear half transparent, how can i set the property only for parent but not the child , either by xml or programatically ?
I think you interpreted that differently, i mean , my linear layout has an alpha property of 0.5 because its laid on top of an imageview,to render a better ux, but all the textviews inside linearlayout aren't supposed to have alpha, but that's the default android behavior i guess,so any workarounds? Setting alpha value of textview to 1 doesnt seem to work...
First, if you set android:visibility="invisible" then the entire view group will be invisible, nothing to change that. Also, it looks like the android:alpha attribute is designed to set the alpha for a view group and all its children. So you shouldn't be using it. Instead, set the background color with the alpha you want. Example:
This looks like:
Note that the first text box, I did not set any specific background color, so it inherited the one from the scroll pane. But the second one I set a specific color, so it gets its own alpha channel, and is not hidden. Also note that I put an image in the FrameLayout, and set the ScrollView to have a gray background color so that you could see the alpha effect more clearly.