簡體   English   中英

如何從其他布局圖像也可以動畫的中心位置旋轉imageview

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

我想從其中心位置旋轉imageView1其他圖像也移動我的布局是

 <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是android:layout_alignRight="@+id/imageView1"android:layout_below="@+id/imageView1"當imageView1動畫那么為什么我imageView2imageView3不遵循這些圖像

我像這樣動畫

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();

在此處輸入圖片說明

就動畫而言,試試這個..

@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);
        }

當您需要使用此動畫時,請嘗試這樣的事情..

your_inatance_image.show();

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM