How to set up animation for the first view from ViewFlipper

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

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

where vf is the ViewFlipper and the populate () method is the method in which I add all my views to the ViewFlipper . My problem is that my animation starts from the first view, not the first. I don’t know where to install the animation on the ViewFlipper so that the animation does not start at a glance. Can anybody help me?

The first view is as follows: enter_image_description I have a black screen (background color) before the first view.

Thanks in advance!

+7
source share
2 answers

Have you tried to use the setDisplayedChild method on ViewFlipper?

0
source

Can you show your XML layout associated with your ViewFlipper? If your layout has something similar:

  <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 need to create a ViewFlipper layout in your class.

0
source

Source: https://habr.com/ru/post/907548/


All Articles