Anyway to programmatically animate layout weight property of linear layout

前端 未结 5 1783
暗喜
暗喜 2021-02-18 15:12

I have two views in a linear layout, I programmatically change their layout_weight property. Is there a way I could animate this change in weight so when the weight is changed v

5条回答
  •  眼角桃花
    2021-02-18 15:56

    I have been looking at this as well. Eventually I solved it by animating the weightsum property of the parent, which works very nice if you have two views in a LinearLayout.

    see: Animating weightSum property using ObjectAnimator

    In the example below, if you animate the weightSum from 1.0 to 2.0, Screen 2 will animate nicely into view.

    
    
    
    
    
    
    
    
    
    
    

提交回复
热议问题