Why are nested weights bad for performance? Alternatives?

后端 未结 6 1578
深忆病人
深忆病人 2020-11-22 16:26

I have written a couple layout files where I used the layout_weight attribute to create a ratio between different views.

At some point, I start getting

6条回答
  •  一个人的身影
    2020-11-22 16:51

    There is an easy solution to avoid nested LinearLayouts with weights - just use Tablelayout with weighSum and nested LinearLayout with weightSum - Tablelayout has the same attributes as LinearLayout(orientation, weightSum, layout_weight, etc.) and doesn't show message - "nested weights have bad for performance"

    Example:

     
    
            
    
    
            
    
    
                
    
                
    
    
                
    
        
    

提交回复
热议问题