Reputation:
I wrote a sample code for image transforming from top to bottom, by using transformation. Here, the image moving correctly, but the problem is, it's transformed under the controls. For example:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<TextView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:id="@+id/text"
android:text="Android Animation"
/>
<ImageView
android:id="@+id/image"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/xxl"
android:layout_marginTop="70dp"
/>
<ImageView
android:id="@+id/image1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/xxl"
android:layout_marginTop="-28dp"
/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
>
<Button android:text="AddToFavorites"
android:id="@+id/AddToFavorites"
android:layout_width="wrap_content"
android:layout_marginTop="100dp"
android:layout_marginLeft="50dp"
android:layout_height="wrap_content">
</Button>
<Button android:text="AddToOrder"
android:id="@+id/AddToOrder"
android:layout_width="wrap_content"
android:layout_marginTop="100dp"
android:layout_height="wrap_content">
</Button>
</LinearLayout>
<ImageView android:id="@+id/imageView1"
android:layout_height="70dp"
android:layout_width="50dp"
android:layout_marginTop="50dp"
android:layout_marginLeft="230dp"
android:src="@drawable/menu">
</ImageView>
</LinearLayout>
If i click the button1, transformation of the image started, from top to bottom, but when it reaches the button , it moves the under of the button(i.e i won't visible at the place of the button, after crossing the button it's visible). My requirement is, i want to move the image over the controls(like, buttons, images, inner layouts..).
Thanks in advance... Regards, Lokesh
Upvotes: 0
Views: 398
Reputation: 9013
Change the parent layout to RelativeLayout. And add some codes in the java to bring the views to front. You just use the function bringToFront() to bring the images in the top.
ImageView m=(ImageView)findViewById(R.id.image);
m.bringToFront();
Upvotes: 1