[英]View hides during animation
我有一个包含两个FrameLayouts(f1和f2)的xml布局。 F1会占据所有屏幕区域,而f2会通过使用android:layout_marginBottom =“-900dp”隐藏在屏幕下方。 布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/llMainLayout"
android:orientation="vertical">
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical">
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/f1" android:background="@color/white">
<fragment
android:id="@+id/leftsidefragment"
android:name="de.com.fragments.ChapterDescriptionPageFragment"
android:layout_width="match_parent"
android:layout_height="fill_parent"/>
</FrameLayout>
<FrameLayout
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/flRightWindowPart"
android:background="@android:color/transparent"
android:layout_gravity="bottom">
<fragment
android:id="@+id/f2"
android:name="de.com.fragments.ChapterSubchaptersListFragmentWithHeader"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</FrameLayout>
</FrameLayout>
</LinearLayout>
然后,我执行翻译动画:f2正在上升。 除了一个麻烦,其他所有工作都很好-在动画过程中f2是不可见的。 构造动画的方法代码:
public Animation constructSlideUpAnimation(boolean inverse){
if (inverse)
return new TranslateAnimation(
Animation.ABSOLUTE, 0.0f, Animation.ABSOLUTE, 0.0f,
Animation.ABSOLUTE, 0.0f, Animation.ABSOLUTE, 900
);
else
return new TranslateAnimation(
Animation.ABSOLUTE, 0.0f, Animation.ABSOLUTE, 0.0f,
Animation.ABSOLUTE, 0.0f, Animation.ABSOLUTE, -900
);
}
如果需要其他一些代码,请编写。 我非常感谢您的帮助。 提前致谢。
通过添加代码来解决该问题,该代码将第二个fragment(f2)的高度设置为value,即动画完成后的高度
我不确定,但是您必须将动画对象的持续时间设置为毫秒。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.