2

如果我在 ScrollView 中执行 LayoutTransition(动画是在 LinearLayout 上完成的),它会很好地扩展。但是,如果我删除某些东西,那么在动画繁忙的时候,一切都会被推上去,这看起来很难看。它与这个问题有些相同:LayoutTransition:2 个容器

这是我的xml:

<ScrollView 
            xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:tools="http://schemas.android.com/tools"
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:fillViewport="true">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <LinearLayout
            android:animateLayoutChanges="true"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@drawable/card"
            android:orientation="vertical"
            android:paddingBottom="@dimen/activity_vertical_margin"
            android:paddingLeft="@dimen/activity_horizontal_margin"
            android:paddingRight="@dimen/activity_horizontal_margin"
            android:paddingTop="@dimen/activity_vertical_margin">

            <View
                android:layout_width="match_parent"
                android:layout_height="5dp"
                android:layout_gravity="left"
                android:layout_marginRight="1dp"
                android:background="#00000000"/>

            <Button
                style="?android:attr/spinnerStyle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/activity_horizontal_margin"
                android:layout_marginRight="@dimen/activity_horizontal_margin"
                android:layout_marginTop="@dimen/activity_vertical_margin"
                android:paddingLeft="@dimen/activity_horizontal_margin"/>

            <Button
                style="?android:attr/spinnerStyle"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginLeft="@dimen/activity_horizontal_margin"
                android:layout_marginRight="@dimen/activity_horizontal_margin"
                android:paddingLeft="@dimen/activity_horizontal_margin"/>

            <EditText
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/activity_vertical_margin"
                android:layout_marginLeft="@dimen/activity_horizontal_margin"
                android:layout_marginRight="@dimen/activity_horizontal_margin"
                android:ems="10"
                android:gravity="start"
                android:hint="@string/addassignment_description_hint"
                android:inputType="textMultiLine|textCapSentences"
                android:minLines="3"/>

            <Button
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="@dimen/activity_vertical_margin"
                android:layout_marginLeft="@dimen/activity_horizontal_margin"
                android:layout_marginRight="@dimen/activity_horizontal_margin"
                android:textColor="@android:color/white"/>
        </LinearLayout>

        <FrameLayout
            android:layout_width="match_parent"
            android:layout_height="0dp"
            android:layout_weight="1">

            <com.google.android.gms.ads.AdView
                android:id="@+id/adView"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_gravity="bottom"
                android:background="@android:color/black"
                ads:adSize="SMART_BANNER"
                ads:adUnitId="@string/ad_unit_id"/>
        </FrameLayout>
    </LinearLayout>
</ScrollView>

有没有人知道如何使用 LinearLayout 使 ScrollView 动画效果很好?

4

0 回答 0