2013-02-01 13 views
-1

我有一個更大的視圖,裏面有一個textview和一個imageview。當我爲y軸設置較大的視圖時,imageview從0旋轉到180度(這正是我想要的),但textview在1度時消失,然後再次出現在180度處翻轉。我也注意到,如果我在20度停止視圖,文本完全不會出現,就好像android不能在除零和180之外的旋轉中顯示文本視圖。我相信我正確地遵循了這些示例。我確實看到了一些使用相機的例子,我應該在旋轉之前先拍攝較大視圖的圖片嗎?我最重要的問題是android動畫是否顯示除了0,180和-180以外的y的旋轉文本視圖? Y在屏幕的平面上。這裏是我的代碼:動畫不能用於與y方向旋轉的textview

FlashQView flashQView = flasQ.getView(); 
    AnimatorSet animatorSet = (AnimatorSet)AnimatorInflater.loadAnimator(this, R.animator.exit); 
    animatorSet.setTarget(flashQView); 
    animatorSet.start(); 

這裏是我的exit.xml動畫文件:

<set xmlns:android="http://schemas.android.com/apk/res/android"> 
    <objectAnimator 
    android:valueFrom="0" 
    android:valueTo="180" 
    android:propertyName="rotationY" 
    android:duration="2000" /> 
    </set> 

在此先感謝。

回答

0

所以我想出了一個解決方案,但仍想知道android動畫是否可以顯示0度,-180度或180度以外的TextView。我用包含textview和imageview的framelayout替換了我的textview。我之前的動畫我設置的ImageView與

textView.buildDrawingCache(); 
    imageView.setImageBitmap(questionTextView.getDrawingCache()); 

的ImageView的看起來就像TextView的,是在和隱藏的TextView。然後我動畫(繞Y軸)和ImageView的被示出在角度0 180之間和 旋轉這裏的的FrameLayout

<FrameLayout 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content">  
    <TextView android:id="@+id/ans_text_view" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:textAppearance="?android:attr/textAppearanceMedium" 
    /> 
    <ImageView 
     android:id="@+id/ans_text_view_image" 
     android:layout_width="match_parent" 
     android:layout_height="wrap_content" 
     android:adjustViewBounds="true" 
    /> 

我沒有使用一個照相機,這是一個問題子。這裏是我得到繪圖緩存的想法第一個答案Create Image from imageview and textview?