Dan*_*iel 5 android splash-screen
在启动我的应用程序时,我希望有一个类似于图像幻灯片的闪屏.通过向左或向右滑动,您可以简要了解应用程序的功能.在每个图像底部的某处,我想修复一个菜单,如项目,以显示图像的导航.它可以简单地是一个实心圆链,告诉用户他们所处的图像.
任何人告诉我这种闪屏的术语是什么,我该怎么做?
谢谢
我想你想在闪屏中显示多个图像。在下面的活动中,它有一个ImageView
显示多个图像并且图像可以以不同的时间间隔显示。
飞溅.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();
}
}
Run Code Online (Sandbox Code Playgroud)
在此 XML 文件中,您必须指定要显示的图像。这里我有 5 个以特定间隔显示的图像。
启动文件
<?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>
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
6550 次 |
最近记录: |