簡體   English   中英

動畫期間查看皮革

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM