Android: Expand/collapse animation

后端 未结 30 2215
说谎
说谎 2020-11-22 05:01

Let\'s say I have a vertical linearLayout with :

[v1]
[v2]

By default v1 has visibily = GONE. I would like to show v1 with an expand animat

30条回答
  •  一生所求
    2020-11-22 05:23

    public static void slide(View v, int speed, int pos) {
        v.animate().setDuration(speed);
        v.animate().translationY(pos);
        v.animate().start();
    }
    
    // slide down
    slide(yourView, 250, yourViewHeight);
    // slide up
    slide(yourView, 250, 0);
    

提交回复
热议问题