Android setting pivot point for scale animation

后端 未结 2 568
青春惊慌失措
青春惊慌失措 2021-02-18 14:34

I am trying to scale views to a certain size but can\'t quite understand how pivoting works.

Say I want to scale the view upwards only. What value should the \"pivotY\"

相关标签:
2条回答
  • 2021-02-18 15:15

    Use:

    view.setPivotY(view.getMeasuredHeight());
    

    If you need to animate your object from the bottom.

    0 讨论(0)
  • 2021-02-18 15:31

    Quite simple actually.

    If you want to scale upwards one clear option is:

     view.setPivotY(100);
    

    and downwards:

     view.setPivotY(0);
    

    then animate.

    0 讨论(0)
提交回复
热议问题