• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Right to left translate animation problem in Android

Flogrimm

Lurker
I have a problem with animation of image that placed out of right or bottom border of parent layout.

This image crops while animation.

First image is original, and second should looks the same, but crops because part of image positioned out of right border.

Look example here

The situation with bottom border the same.

AnimationProblem.gif


Animation:

Code:
public void onClickDo(View view) {
    ImageView img = (ImageView) findViewById(R.id.imageView2);

    TranslateAnimation anim = new TranslateAnimation(0f, -100f, 0f, 0f);
    anim.setDuration(1000);

    img.startAnimation(anim);
}

Layout:

Code:
<?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"
    >
    <RelativeLayout android:layout_width="fill_parent" android:id="@+id/relativeLayout1" android:layout_height="wrap_content">
        <ImageView android:id="@+id/imageView1" android:src="@drawable/problem" android:layout_width="100dip" android:layout_height="100dip"></ImageView>
        <ImageView android:id="@+id/imageView2" android:src="@drawable/problem" android:layout_height="100dip" android:layout_width="100dip" android:layout_marginLeft="250dip" android:scaleType="matrix" android:layout_marginTop="110dip"></ImageView>
        <Button android:layout_alignParentBottom="true" android:layout_height="wrap_content" android:layout_width="wrap_content" android:id="@+id/button1" android:text="Button" android:onClick="onClickDo"></Button>
    </RelativeLayout>
</LinearLayout>
 
Back
Top Bottom