Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make a splash screen like image slide

In the booting of my application, I wanted to have a splash screen that resembles image slide. By swiping left or right, you can have a brief view of functions of the app. Somewhere at the bottom of each image, I wanted to fix a menu like item to show a navigation of the images. it can simply be a chain of solid circles which tell user which image they are at.

any one tell me what's the term for this kind of splash screen and how can I do that?

Thanks

like image 481
Daniel Avatar asked Nov 24 '22 07:11

Daniel


1 Answers

I think u want to display Multiple Images in a Splashscreen.In the Below Activity, it has a ImageView which displays Multiple Images & the Images can be displayed at diferennt Time intervals.

Splash.java

public class Splash extends Activity {
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.activity_splash);
            final ImageView splashImageView = (ImageView) findViewById(R.id.SplashImageView);
            splashImageView.setBackgroundResource(R.anim.splash);
            final AnimationDrawable frameAnimation = (AnimationDrawable)splashImageView.getBackground(); 
                            Thread timer= new Thread(){
                                                        public void run(){
                    try{
                                    sleep(7000);
                    }catch(InterruptedException e){
                    e.printStackTrace();
                }finally {
                    Intent splash =new Intent("com.arul.remoteit.Main");
                    startActivity(splash);
                }
                }
            };
        timer.start();
            splashImageView.post(new Runnable(){
                @Override
                public void run() {
                    frameAnimation.start();    
                               }            
            });
                }
    @Override
            protected void onPause() {
                // TODO Auto-generated method stub
                super.onPause();
                finish();
            }

        }

In this XML file you have to specify the Images which has to be displayed.Here i have 5 images which is displayed at particular intervals.

splash.xml

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" 
    android:id="@+id/flaganim"
    android:oneshot="false"
    >
    <item android:drawable="@drawable/s1" android:duration="1000" />
    <item android:drawable="@drawable/s2" android:duration="1000" />
    <item android:drawable="@drawable/s3" android:duration="1000" />
     <item android:drawable="@drawable/s4" android:duration="1000" />
    <item android:drawable="@drawable/s5" android:duration="1000" />
    </animation-list>
like image 183
AruLNadhaN Avatar answered Dec 06 '22 02:12

AruLNadhaN