how to set no animation for first view from ViewFlipper
Asked Answered
G

2

7

I have a ViewFlipper with different views. When my activity starts I want that first view to appear suddenly, and after 3 seconds (flipper time) to animate to next view. Here is my code:

vf.setOutAnimation(animFlipOutNext);
vf.setInAnimation(animFlipInNext);
vf.startFlipping();
populate();

where vf is ViewFlipper and the populate() method is the method where I add all my views to ViewFlipper. My problem is that my animation starts from first view, and not from first. I don't know where should I set the animation to my ViewFlipper for make my animation to not start from first view. Can anyone help me?

First view appears like this :enter_image_description I have a black screen (the color of background) before first view.

Thanks in advance!

Gonorrhea answered 3/2, 2012 at 8:15 Comment(1)
does your activity always run in lanscape mode?Houseboat
G
0

Have you tried using the setDisplayedChild method on the ViewFlipper?

Gargan answered 8/2, 2012 at 13:13 Comment(1)
setDisplayedChild actually uses the animation, showPrevious and showNext are just convenience wrapper methodsJoan
S
0

Can you show your XML layout related with your ViewFlipper? If you have something similar to this in your layout:

  <ViewFlipper
    android:id="@+id/details"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
    <TextView
      android:id="@+id/text_one"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:textColor="#FFFFFFFF"
      android:textSize="20sp"
      android:textStyle="bold" />
    <TextView
      android:id="@+id/text_two"
      android:layout_width="fill_parent"
      android:layout_height="wrap_content"
      android:textColor="#FFFFFF99"
      android:textSize="18sp" />
  </ViewFlipper>

Try something like this:

  <ViewFlipper
    android:id="@+id/details"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">
  </ViewFlipper>

Finally, you have to build your ViewFlipper layout on your Class.

Spasm answered 21/12, 2016 at 12:50 Comment(1)
This question is 4 years old, I'm not sure he will post more code now...Labium

© 2022 - 2024 — McMap. All rights reserved.