I am trying to do a move + fade in animations to an imageView. I want it to slide from outside the screen to the middle of the screen. here's what I have tried :
activity xml:
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentTop="true"
android:layout_alignParentRight="true">
<ImageView
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:src="@drawable/city"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="false"
android:scaleType="fitEnd"
android:id="@+id/cityImage" />
</RelativeLayout>
move.xml
<set
xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/linear_interpolator"
android:fillAfter="true">
<translate
android:fromYDelta="-70%p"
android:toYDelta="0%p"
android:duration="1500" />
</set>
move function :
public void move(){
ImageView image = (ImageView)findViewById(R.id.cityImage);
Animation animation1 = AnimationUtils.loadAnimation(getApplicationContext(), R.anim.move);
image.startAnimation(animation1);
}
as you can see I thought the javascript way by doing -70%p but it doesnt seem to work in android. can you please suggest me an other way?