Android: Expand/collapse animation

后端 未结 30 2200
说谎
说谎 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:45

    Yes, I agreed with the above comments. And indeed, it does seem like the right (or at least the easiest?) thing to do is to specify (in XML) an initial layout height of "0px" -- and then you can pass in another argument for "toHeight" (i.e. the "final height") to the constructor of your custom Animation sub-class, e.g. in the example above, it would look something like so:

        public DropDownAnim( View v, int toHeight ) { ... }
    

    Anyways, hope that helps! :)

提交回复
热议问题