1

I have three views(A, B, and C) which are stacked over one another. So when I click on a button the two views (B and C) animate from behind View A and scroll down to the bottom. Now my animation is working fine but the views B and C are extending out of the screen and my screen's height is not increasing. Here is my layout.xml

<?xml version="1.0" encoding="utf-8"?>
<ScrollView
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:fillViewport="true"
    android:animateLayoutChanges="true">

    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools"
        android:id="@+id/trips_menu_layout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:background="@color/colorBackgroundGrey">

        <android.support.v7.widget.CardView
            xmlns:card_view="http://schemas.android.com/apk/res-auto"
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:id="@+id/layout_id_1"
            android:layout_margin="8dp"
            card_view:contentPadding="8dp"
            card_view:cardElevation="16dp">

        </android.support.v7.widget.CardView>

        <android.support.v7.widget.CardView
            xmlns:card_view="http://schemas.android.com/apk/res-auto"
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:id="@+id/layout_id_2"
            android:layout_marginLeft="8dp"
            android:layout_marginStart="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:layout_marginBottom="8dp"
            android:layout_marginTop="40dp"
            card_view:contentPadding="8dp"
            card_view:cardElevation="2dp">

        </android.support.v7.widget.CardView>

        <android.support.v7.widget.CardView
            xmlns:card_view="http://schemas.android.com/apk/res-auto"
            android:layout_width="match_parent"
            android:layout_height="300dp"
            android:id="@+id/layout_id_3"
            android:layout_marginLeft="8dp"
            android:layout_marginStart="8dp"
            android:layout_marginEnd="8dp"
            android:layout_marginRight="8dp"
            android:layout_marginBottom="8dp"
            android:layout_marginTop="40dp"
            card_view:contentPadding="8dp"
            android:visibility="invisible">

        </android.support.v7.widget.CardView>

    </RelativeLayout>

</ScrollView>

And my animation is simple translation Y animation.

Any suggestions as to how to increase the height of the layout as the two views animate to the bottom?

AND_SUN
  • 97
  • 2
  • 10

0 Answers0