2013-07-05 55 views
0

我有一個框架佈局,填補了電話區域(fill_parent)。另外一個imageView保存在框架佈局centreInParent中。非動畫視圖內的動畫視圖android

現在我正在使用縮放動畫來減小幀佈局的大小。但我不想讓imageView縮小尺寸,除此之外,我想將imageView中心移動到框架佈局的縮放比例。

我該如何做到這一點?

我的xml:

<FrameLayout 
     android:layout_height="match_parent" 
     android:layout_width="match_parent" 
     android:id="@+id/id" 
     android:background="@drawable/bg" > 
     <ImageView 
      android:layout_height="wrap_content" 
      android:layout_width="wrap_content" 
      android:gravity="center" 
     android:layout_centerInParent="true" 

      android:src="@drawable/bglogo"/> 

    </FrameLayout> 

謝謝!

+0

從已應用的動畫 –

+0

這是邏輯框架佈局只是要ImageView的獨立。但我不知道如何使用代碼來實現這一點 – arul

+0

只需從FrameLayout中刪除圖像視圖並使其獨立;請發佈您的xml代碼 –

回答

0

更改您的佈局以下列方式

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
> 
<FrameLayout 
    android:layout_height="match_parent" 
    android:layout_width="match_parent" 
    android:id="@+id/id" 
    android:background="@drawable/bg" > 

</FrameLayout> 
<ImageView 
     android:layout_height="wrap_content" 
     android:layout_width="wrap_content" 
     android:gravity="center" 
    android:layout_centerInParent="true" 
     android:src="@drawable/bglogo"/> 
</RelativeLayout> 
+0

只有frameLayout經歷縮放動畫,但圖像視圖是固定的 – arul

+0

動畫之後根據需要更改ImageView的參數 –