Can't set visibility on constraint group

前端 未结 6 1548
广开言路
广开言路 2020-12-16 09:01

When i try to set the visibility of the group on button click,it doesn\'t affect the view\'s visibility.Using com.android.support.constraint:constraint-layout:1.1.0-beta4. I

6条回答
  •  感情败类
    2020-12-16 09:40

    You can also simply call requestLayout method after changing Group visibility to View.INVISIBLE.

    fun makeGroupInvisible(group: Group) {
        group.visibility = View.INVISIBLE
        group.requestLayout()
    }
    

    Problem is that android.support.constraint.Group updates visibility of its members in updatePreLayout method which is called from onMeasure in ConstraintLayout.

提交回复
热议问题