-1

I have a larger view with a textview and an imageview inside of it. when i animate the larger view about the y axis, the imageview rotates from 0 to 180 degrees (which is what I want), but the textview disappears at 1 degrees and then reappears flipped at 180degrees. I've also noticed if I stop the view at 20 degrees the text doesn't appear at all, it's as if android can't show text views at rotations other than zero and 180. I believe I'm following the examples correctly. I do see some examples using Camera, should I take a picture of the larger view first before rotating it? My most important question is can android animations show textviews at rotations of y other than 0, 180 and -180? Y is in the plane of the screen up. Here's my code:

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

here is my exit.xml animator file:

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

Thanks in advance.

Richard
  • 56,349
  • 34
  • 180
  • 251
flobacca
  • 936
  • 2
  • 17
  • 42

1 Answers1

0

So I came up with a solution, but would still like to know if android animations can show TextViews at degrees other than 0, -180, or 180. I substituted my textview with a framelayout containing a textview and an imageview. Before I animate I set the imageview with

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

the imageView looks just like the textView and is over and hiding the textView. Then I animate (rotate about the Y axis) and the imageview is shown rotating at angles between 0 and 180. Here's the 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"  
     />   

I didn't have to use a camera, which was a sub question. Here's where I got the idea for the drawing cache First Answer Create Image from imageview and textview?

Community
  • 1
  • 1
flobacca
  • 936
  • 2
  • 17
  • 42