我有一个包含另外两个垂直方向的LinearLayouts的LinearLayout。
顶部内部LinearLayout始终可见;底部内部LinearLayout有时可见。
在顶部的内部LinearLayout上有一个视图,用户可以按下以显示底部的LinearLayout。但是,我希望从顶部LinearLayout中“下拉”出底部的LinearLayout。
我在做这个的时候遇到了一些真正的麻烦。理想情况下,我想让它看起来像是从顶部的LinearLayout下面滑出来的(这意味着不仅LinearLayout的底部从顶部滑出,而且所有的控件看起来也是如此),但我甚至无法让LinearLayout的尺寸变得生动(读作: grow)。
有什么建议吗?
发布于 2011-03-30 06:20:22
我假设您使用的是Animation类。您可以做的是在xml中使用android:layout_AlignParentBottom = "true“将下拉LinearLayout锚定到第一个的底部。然后在您的动画文件夹中放入类似如下的内容:
<scale xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXScale="0.0"
android:toXScale="1.0"
android:duration="whatever (in milliseconds)"
android:interpolator="@android:anim/linear_interpolator"
/>
将其命名为dropdownanim
然后在某个时间将该动画设置为视图。
private Animation mAnimation;
mAnimation = AnimationUtils.loadAnimation(this, R.anim.dropdownanim);
linearlayoutview.startAnimation(mAnimation);
https://stackoverflow.com/questions/5479462
复制相似问题