简体   繁体   中英

how to rotate imageview from its centre position that other layout images also animate

i want to rotate imageView1 from its centre position other image also move my layout is

 <ImageView
    android:id="@+id/imageView1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_centerHorizontal="true"
    android:layout_marginTop="86dp"
    android:src="@drawable/top_pati" />
<ImageView
    android:id="@+id/imageView2"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignLeft="@+id/imageView1"
    android:layout_below="@+id/imageView1"
    android:src="@drawable/top_pativertical" />
<ImageView
    android:id="@+id/imageView3"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignRight="@+id/imageView1"
    android:layout_below="@+id/imageView1"
    android:src="@drawable/top_pativertical" />

imageView3 is android:layout_alignRight="@+id/imageView1" and android:layout_below="@+id/imageView1" when imageView1 animate then why my imageView2 and imageView3 not follow these images

I animate like this

RotateAnimation anim = new RotateAnimation(0, 15, Animation.RELATIVE_TO_SELF,
                    0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
            anim.setInterpolator(new LinearInterpolator());
            anim.setDuration(500);
            anim.setFillEnabled(true);
            anim.setFillAfter(true);
            imageView.startAnimation(anim);
            setuplayout();

在此处输入图片说明

As far animation is concerned try this ..

@Override
        public void show() {
            super.show();
            RotateAnimation anim = new RotateAnimation(0.0f, 360.0f , Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f);
            anim.setInterpolator(new LinearInterpolator());
            anim.setRepeatCount(Animation.INFINITE);
            anim.setDuration(3000);
            iv.setAnimation(anim);
            iv.startAnimation(anim);
        }

When you need to use this animation then try some thing like this ..

your_inatance_image.show();

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM