0

I m sliding down the Layout (which has different ImageView), from top to bottom using TranslateAnimation, but when it get slide, its Touchable area still stick to previous position, it doesnt move downwards along with ImageView, it is showing visually that its Y axis get moved from some value, but its touchable area still at original place.

Please help me in solving this problem.

I have used this for sliding animation :

TranslateAnimation t =new TranslateAnimation(0, 0,0,35);
t.setDuration(200);
t.setFillAfter(true);   
t.setInterpolator(new LinearInterpolator());
menuSlideBgId.startAnimation(t);
inFram.startAnimation(t);

This is my lyaout file

<?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:gravity="left|right"
    android:orientation="vertical" 
    android:background="@drawable/bg_android"
    >


    <ImageView
        android:id="@+id/imageView1"
        android:layout_width="150dp"
        android:layout_height="68dp"
        android:layout_gravity="center"
        android:layout_marginTop="15dp"
        android:src="@drawable/thinknsay" />

    <RelativeLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/rLay"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical" >


      <ImageView
              android:id="@+id/menuSlideBg"
              android:layout_width="339dp"
              android:layout_marginLeft="130dp"
              android:layout_marginTop="452dp"
              android:layout_height="35dp"
              android:src="@drawable/menu_slide3" />      

          <RelativeLayout
              xmlns:android="http://schemas.android.com/apk/res/android"
              android:id="@+id/slideNavLayout"
              android:layout_width="match_parent"
              android:layout_height="550dp" >

              <ImageView
                  android:id="@+id/bubbleMenu"
                  android:layout_width="28dp"
                  android:layout_height="28dp"
                  android:layout_gravity="left"
                  android:layout_marginLeft="180dp"
                  android:layout_marginTop="455dp"
                  android:src="@drawable/buble_icon" />

              <ImageView
                  android:id="@+id/shareMenuId"
                  android:layout_width="28dp"
                  android:layout_height="28dp"
                  android:layout_gravity="left"
                  android:layout_marginLeft="225dp"
                  android:layout_marginTop="455dp"
                  android:onClick="shareMenu"
                  android:src="@drawable/share_icon" />
        </RelativeLayout>
    </RelativeLayout>
</LinearLayout>
SML
  • 2,172
  • 4
  • 30
  • 46

1 Answers1

1

TranslateAnimation just re-draws the view at different positions over time, it doesn't really moves the View. You need to change its layout position also, ObjectAnimator can be used to change View properties.

S.D.
  • 29,290
  • 3
  • 79
  • 130
  • and how about the FrameAnimation, i have set of Images that i can move with creating XML in res->anim and writing but problem is same, the touchable area still at same place, how can i achieve FrameAnimation with moved touchable area? – SML Dec 23 '12 at 14:10