在制作“下拉菜单”动画时遇到问题
我有一个 LinearLayout,其中包含另外两个垂直方向的 LinearLayout。
顶部内部LinearLayout始终可见;底部内部 LinearLayout 有时是可见的。
顶部内部 LinearLayout 上有一个视图,用户可以按下以显示底部 LinearLayout。但是,我希望底部 LinearLayout 从顶部 LinearLayout 中“下拉”。
我在做这件事时遇到了一些真正的麻烦。理想情况下,我想让它看起来像是从顶部 LinearLayout 下掉出来的(这意味着不仅 LinearLayout 的底部从顶部滑出,而且所有控件也似乎都从顶部滑出),但我甚至无法让 LinearLayout 的尺寸进行动画处理(阅读:增长)。
有什么建议吗?
I have a LinearLayout that contains two other LinearLayouts, oriented vertically.
The top inner LinearLayout is always visible; the bottom inner LinearLayout is sometimes visible.
There a view on the top inner LinearLayout the user can press to make the bottom LinearLayout show. However, I would like the bottom LinearLayout to "drop down" out of the top LinearLayout.
I'm having some real trouble doing this. Ideally, I'd like to make it look like it was dropping out from under the top LinearLayout (meaning not only does the bottom of the LinearLayout slide out from the top, but all the controls appear to as well), but I'm having trouble even getting the dimensions of the LinearLayout to animate (read: grow).
Any suggestions?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我假设您正在使用动画类。您可以做的是将下拉菜单 LinearLayout 锚定到第一个的底部,在 xml 中使用 android:layout_AlignParentBottom = "true" 。然后在你的 anim 文件夹中放入类似以下内容:
将其命名为 dropdownanim
然后在某个时间将该动画设置为视图。
I'm assuming you're using the Animation class. What you could do is anchor the dropdown LinearLayout to the bottom of the first using android:layout_AlignParentBottom = "true" in your xml. Then in your anim folder put something like:
name it dropdownanim
Then set that animation to the view at a certain time.