ConstraintLayout: set height of all views in row to match the tallest one

后端 未结 4 2018
佛祖请我去吃肉
佛祖请我去吃肉 2020-12-29 21:35

I\'m trying to utilize a ConstraintLayout (version 1.0.2) to set the height of 2 side-by-side views to match the tallest one of them. This serves as a ViewHolder in for a Re

4条回答
  •  独厮守ぢ
    2020-12-29 22:18

    This is tricky and slow, but it works.

    The point is:

    • Add additional invisible same layout for measure height. This one has wrap_content height attribute, so it will stretch parent if it is big enough.
    • Set your visible layout height to 0dp, so it will fill rest of parent.

    As you can see the capture below, we have two layouts. Hidden one is wrap_contents

    
    
    
        
    
        
    
        
    
        
    
    
    

提交回复
热议问题