Android Auto Slide Image

I am trying to write a very simple Android application that displays about 5 shots one by one on the screen. I want it to display another image after about 10 seconds. Can anyone advise me how I will get around this. Below I set out what I would be looking for.

Image 1

Image 2

Image 3

Image 4

Picture 5

show full screen Image 1 wait 10 seconds Delete image 1 and display image 2 Wait 10 seconds Delete image 2 and display image 3 Wait 10 seconds Take image 3 and image 4 Wait 10 seconds Delete image 4 and display image 5 Wait 10 seconds

Start again ... thanks

+4
source share
2

View flipper - , TimerTask View Flipper.

TimerTask Viewflipper.showNext();

post.

startFlipping() setFlipInterval() ViewFlipper

http://android-er.blogspot.com/2011/03/auto-flipping-of-viewflipper.html

http://javatechig.com/android/android-viewflipper-example

, - .

+4

viewflipper :

view_flipper.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >

<ViewFlipper
    android:id="@+id/viewflipper"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:autoStart="true"
    android:flipInterval="2000" >

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/picture1" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/picture2" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/picture3" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/picture4" />

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:src="@drawable/picture5" />
</ViewFlipper>

</RelativeLayout>

xml onCreate mainActivity. :

public class MainActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.view_flipper);
}

. , autoStart: true xml.

+12

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


All Articles