I want to ask is it possible to change the alpha for a constraint group?
<android.support.constraint.Group
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:constraint_referenced_ids="statusTv, statusDropDownIv"
android:id="@+id/buttonGroup"
android:visibility="visible"
android:alpha="0" />
Right now the visibility
tag has effect if I set it to visible/gone but the alpha
tag seems to not work.
Group is only used for controlling the visibility of Referenced Ids in app:constraint_referenced_ids
. According to the documentation.
The visibility of the group will be applied to the referenced widgets. It's a convenient way to easily hide/show a set of widgets without having to maintain this set programmatically.
I created this extension function to help me achieve this functionality
fun Group.setAlphaForAll(alpha: Float) = referencedIds.forEach {
rootView.findViewById<View>(it).alpha = alpha
}
And then in code I use it like this
my_group.setAlphaForAll(0.4f)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With