2013-09-27 36 views
3

我需要旋轉一個大於屏幕的輪子圖像(這是必須的)。圖像大於屏幕會在動畫時裁剪

的問題是,所述機器人:scaleType =「中心」是必要的,而不被縮放以顯示比屏幕圖像更大,並且該相同的標籤作物旋轉時圖像(參見下圖)

enter image description here

這裏是我的佈局代碼:

<ImageView 
    android:id="@+id/wheel_img" 
    android:scaleType="center" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:src="@drawable/wheel_test" /> 

我的活動:

ImageView wheel_img = (ImageView) findViewById(R.id.wheel_img); 
wheel_img.startAnimation(AnimationUtils.loadAnimation(this, R.anim.rotation)); 

和動畫/ rotation.xml

<rotate 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    android:interpolator="@android:anim/linear_interpolator" 
    android:fromDegrees="0" 
    android:toDegrees="30" 
    android:pivotX="50%" 
    android:pivotY="50%" 
    android:fillAfter="true" 
    android:duration="2000" /> 

不知道如何解決這個問題?其實這很緊急!

在此先感謝!

回答

3

這是把戲,我使用

使用的FrameLayout

<FrameLayout 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
    > 

     <ImageView 
      android:id="@+id/wheel_image" 
      android:layout_width="image width" 
      android:layout_height="image height" 
      android:src="@drawable/wheel_test" 
      android:layout_gravity="center" /> 

的作品就像一個魅力。

這就是我的第一個貢獻。希望它與你

+0

它的工作原理。謝謝 – Kit

0

加入您的視圖滾動視圖內開了竅

  <ScrollView 
      android:layout_width="fill_parent" 
      android:layout_height="fill_parent" 
      android:scrollbars="none" > 

      <LinearLayout 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:layout_gravity="center" > 

       <ImageView 
        android:id="@+id/iv_light_streak" 
        android:layout_width="500dp" 
        android:layout_height="500dp" 
        android:layout_gravity="center"       
        android:scaleType="centerInside" 
        android:src="@drawable/wheel_test" /> 
      </LinearLayout> 
     </ScrollView>