Can't set visibility on constraint group

前端 未结 6 1551
广开言路
广开言路 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:37

    android.support.constraint.Group has a public method

     public void updatePreLayout(ConstraintLayout container) {
       ...
     }
    

    that updates children visibilities, so calling

    dataGroup.visibility = if (visible) View.VISIBLE else View.INVISIBLE
    dataGroup.updatePreLayout(root)
    

    worked for me

提交回复
热议问题