How to animate scaling of a relative layout(Which contains many layouts and ImageViews inside)

Viewed 303

I tried with scaling but while scaling layouts inside are shrinking, Can anyone explain how to animate a layout without shrinking

need to scale letterLayout from a little bit above the parent bottom to top

Animation anim = new ScaleAnimation(
            1f, 1f, // Start and end values for the X axis scaling
            startScale, endScale, // Start and end values for the Y axis scaling
            Animation.RELATIVE_TO_SELF, 0f, // Pivot point of X scaling
            Animation.RELATIVE_TO_SELF, 1f); // Pivot point of Y scaling
    anim.setFillAfter(false); // Needed to keep the result of the animation
    anim.setDuration(1000);
    v.startAnimation(anim);

Layout code

<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:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context="com.sample.LaunchScreenActivity">


    <ImageView
        android:layout_marginTop="195dp"
        android:layout_marginLeft="26dp"
        android:src="@drawable/ic_envelope_back"
        android:layout_width="308dp"
        android:layout_height="327dp" />

    <RelativeLayout

        android:id="@+id/letterLayout"
        android:layout_width="284dp"
        android:layout_height="451dp"
        android:layout_marginLeft="38dp"
        android:layout_marginTop="19dp">

        <RelativeLayout

            android:id="@+id/logo_layout"
            android:layout_width="284dp"
            android:layout_height="236dp"
            android:background="#ff33">

            <ImageView
                android:layout_centerInParent="true"
                android:src="@drawable/ic_logo_launch_screen"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content" />
        </RelativeLayout>

        <RelativeLayout
            android:background="#ff3344"
            android:layout_below="@id/logo_layout"
            android:layout_width="284dp"
            android:layout_height="215dp">

            <Button
                android:layout_width="160dp"
                android:layout_height="41dp"
                android:layout_marginTop="30dp"
                android:layout_centerHorizontal="true"
                android:background="#FC5D2D"
                android:text="brinblox_login"
                android:textColor="#ffff"/>

        </RelativeLayout>
    </RelativeLayout>


    <FrameLayout
        android:layout_marginTop="316dp"
        android:layout_width="308dp"
        android:layout_height="206dp"
        android:layout_marginLeft="26dp">

        <ImageView
            android:layout_width="wrap_content"
            android:layout_height="match_parent"
            android:src="@drawable/ic_envelope_front"/>
    </FrameLayout>
</RelativeLayout>
1 Answers
Related