欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  移动技术

android实现Splash闪屏效果示例

程序员文章站 2024-03-07 12:30:21
本文实例讲述了android实现splash闪屏效果的方法。分享给大家供大家参考,具体如下: java代码: public class splash exten...

本文实例讲述了android实现splash闪屏效果的方法。分享给大家供大家参考,具体如下:

java代码:

public class splash extends activity{
  private final int splash_display_lenght = 1000;
  @override
  protected void oncreate(bundle savedinstancestate) {
    // todo auto-generated method stub
    super.oncreate(savedinstancestate);
    setcontentview(r.layout.splash);
    new handler().postdelayed(new runnable(){
      @override
      public void run() {
        // todo auto-generated method stub
        intent mainintent = new intent(splash.this, application.class);
        splash.this.startactivity(mainintent);
        splash.this.finish();
      }
    }, splash_display_lenght);
  }
}

androidmanifest.xml

xml代码:

<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".application" android:label="@string/app_name">
      <intent-filter>
        <action android:name="android.intent.action.default" />
        <category android:name="ndroid.intent.category.view" />
      </intent-filter>
    </activity>
    <activity android:name="splash" android:label="@string/app_name">
      <intent-filter>
        <action android:name="android.intent.action.main" />
        <category android:name="android.intent.category.launcher" />
      </intent-filter>
    </activity>
</application>

ps:这里再为大家提供一个关于androidmanifest.xml权限控制的在线查询工具:

android manifest功能与权限描述大全:
http://tools.jb51.net/table/androidmanifest

更多关于android相关内容感兴趣的读者可查看本站专题:《android编程之activity操作技巧总结》、《android视图view技巧总结》、《android操作sqlite数据库技巧总结》、《android操作json格式数据技巧总结》、《android数据库操作技巧总结》、《android文件操作技巧汇总》、《android编程开发之sd卡操作方法汇总》、《android开发入门与进阶教程》、《android资源操作技巧汇总》及《android控件用法总结

希望本文所述对大家android程序设计有所帮助。