动画expandableListView [英] Animation for expandableListView

查看:247
本文介绍了动画expandableListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有可能适用的展开或折叠动画expandableListView?

Is it possible to apply an expand or collapse animation for expandableListView?

推荐答案

它可以用一个简单的ListView包含最初隐藏的视图,并扩展动画自定义类来完成。 其基本思路是先从 View.GONE 然后逐渐重新大小的利润率从负值到所需的大小而设置能见度查看。可见

It can be done using a simple ListView that contains an initially hidden view and a custom class that extends Animation. The basic idea is to start with View.GONE then gradually re-size the margin from a negative value to the required size while setting visibility to View.VISIBLE.

请参阅:

  • https://github.com/tjerkw/Android-SlideExpandableListView
  • Android Animation: Hide/Show Menu
  • How do I animate View.setVisibility(GONE)

..最后

  • Cool toolbar for ListView items + source

最后一个例子包含了所有你需要的code。它看起来有点hackish对我来说,特别是事实,你必须首先设置 view.bottomMargin = -50 以上,否则动画不会在第一次正常工作,但到目前为止,我没有发现任何可行的替代方案(除了使用滚动型用自己的容器的项目,而不是一个ListView)。

The last example contains all the code you need. It looks a bit hackish to me, especially the fact that you must initially set view.bottomMargin = -50 or more, otherwise the animation does not work properly the first time, but so far I did not find any viable alternative (apart from using a ScrollView with your own container items instead of a ListView).

最后,这个程序包括上面的例子中,其中很多其他有用的例子链接到源:

And finally, this app includes the above example, among lots of other useful examples with links to sources:

更新:谷歌删除从Play商店的应用程序涉嫌知识产权侵犯(虽然它仅包含演示和链接开源项目),笔者现在所取得的APK可从的 http://goo.gl/ihcgs 欲了解更多详情,请参阅 https://plus.google.com/108176685096570584154/posts 。注:我不属于作者

Update: Google removed the app from play store allegedly for intellectual property violation (although it only contained demos and links to open source projects), the author now made the apk available for direct download from http://goo.gl/ihcgs For more details see https://plus.google.com/108176685096570584154/posts. NB: I'm not affiliated with the author.

这篇关于动画expandableListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆