简体   繁体   English

动画期间查看皮革

[英]View hides during animation

I have a xml-layout that consists two FrameLayouts(f1 and f2). 我有一个包含两个FrameLayouts(f1和f2)的xml布局。 F1 fills all screen's area, and f2 is hided under the screen by using android:layout_marginBottom="-900dp". F1会占据所有屏幕区域,而f2会通过使用android:layout_marginBottom =“-900dp”隐藏在屏幕下方。 Layout: 布局:

<?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>

Then I do the translate animation: f2 is rising up. 然后,我执行翻译动画:f2正在上升。 All works fine except for one trouble - f2 is invisible during the animation. 除了一个麻烦,其他所有工作都很好-在动画过程中f2是不可见的。 Code of method that construct the animation: 构造动画的方法代码:

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
              );
}

Write if you need some others chunks of code. 如果需要其他一些代码,请编写。 I really appreciate any help. 我非常感谢您的帮助。 Thanks in advance. 提前致谢。

通过添加代码来解决该问题,该代码将第二个fragment(f2)的高度设置为value,即动画完成后的高度

我不确定,但是您必须将动画对象的持续时间设置为毫秒。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM