Uygulamamda, görüntüleri animasyon kullanarak taşımaya çalışıyorum. Görüntüyü (imageView2
veya imageView4
) imageView1
ile canlandırmayı denediğimde, görüntü Düzenin dışına çıktığında kesiliyor. İşte Kaynak görüntü imageView2
veya imageView4
ve hedef görüntü AşağıdaclipChildren çalışmıyor
imageView1
benim XML'dir:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/animRL"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:clipChildren="false"
android:clipToPadding="false"
android:orientation="vertical" >
<ImageView
android:id="@+id/imageView1"
android:layout_width="40dp"
android:layout_height="60dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:src="@drawable/deskcard" />
<RelativeLayout
android:id="@+id/baselayout"
android:layout_width="match_parent"
android:layout_height="120dp"
android:layout_alignParentRight="true"
android:layout_below="@+id/imageView1"
android:clipChildren="false"
android:clipToPadding="false" >
<RelativeLayout
android:id="@+id/layout"
android:layout_width="match_parent"
android:layout_height="100dp"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginBottom="5dp"
android:clipChildren="false"
android:clipToPadding="false"
android:gravity="bottom|center" >
<ImageView
android:id="@+id/imageView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignTop="@+id/imageView4"
android:layout_marginLeft="118dp"
android:clipChildren="false"
android:clipToPadding="false"
android:src="@drawable/test" />
<ImageView
android:id="@+id/imageView4"
android:layout_width="40dp"
android:layout_height="60dp"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_marginBottom="16dp"
android:layout_marginRight="104dp"
android:clipChildren="false"
android:clipToPadding="false"
android:src="@drawable/test1" />
</RelativeLayout>
</RelativeLayout>
</RelativeLayout>
Ve animasyon kod aşağıda: En RelativeLayout ebeveynlerinin
imageView4.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
// TODO Auto-generated method stub
int sourceCoords[] = new int[2];
int targetCoords[] = new int[2];
int xDelta;
int yDelta;
imageView4.getLocationOnScreen(sourceCoords);
image.getLocationOnScreen(targetCoords);
xDelta = targetCoords[0] - sourceCoords[0];
yDelta = targetCoords[1] - sourceCoords[1];
TranslateAnimation animation = new TranslateAnimation(0, xDelta, 0, yDelta);
animation.setDuration(400);
animation.setFillAfter(false);
animation.setAnimationListener(new MyAnimationListener());
imageView4.startAnimation(animation);
}
});
bunu denedi ama çalışmıyor ... – Vamshi
Benim için çalıştı, yanıt için teşekkürler! Görünüşe göre, bir düzen eklediğinizde ve bu benim için sorun oluşturduğunda bazı görüşler eklendi. – shalafi
benim için çalıştı. üzgün kullanmam gerekti :( – Sam