android 启动页面
2016-02-16 10:53
531 查看
很多应用都有启动页面,如何做一个高效的,退出应用后再进依旧能快速启动的启动页面。
直接贴代码
点击打开链接
直接贴代码
代码如下:启动页面Activity代码如下:
public class SplashScreen extends BaseActivity{ /* * Called when the activity is first created. */ @Override public void onCreate(Bundle icicle) { super.onCreate(icicle); setContentView(R.layout.splashscreen); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); // 设置全屏,不需要可去掉 new Handler().postDelayed(new Runnable() { public void run() { /* Create an Intent that will start the Main WordPress Activity. */ Intent mainIntent = new Intent(SplashScreen.this, MainActivity.class); SplashScreen.this.startActivity(mainIntent); overridePendingTransition(R.anim.activity_in, R.anim.activity_out);// 淡出淡入动画效果 SplashScreen.this.finish(); } }, 3000); //2900 for release } }
AndroidManifest.xml配置如下
<activity android:name=".activity.SplashScreen" android:launchMode="singleTop" android:screenOrientation="portrait" android:theme="@style/Theme.AppStartLoad"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity>
styles.xml配置如下:
<style name="Theme.AppStartLoad" parent="MainTheme"> <item name="android:windowBackground">@mipmap/aplash_back</item><!--一张图片--> <item name="android:windowNoTitle">true</item> </style>
overridePendingTransition(R.anim.activity_in, R.anim.activity_out);// 淡出淡入动画效果这段代码是为了让启动页面淡化过渡到app的主页面 ,两个xml文件内容可到这里查看
点击打开链接
相关文章推荐
- (转)android中src和background区别 代码设置
- 分析应用使用的技术框架和开源库
- Android拍摄的视频无法在IOS播放
- android应用实现虚线
- Android中ResultReceiver使用
- Android Studio开发-引用jar及so文件
- Git学习
- Android浏览图片,点击放大至全屏效果
- android日常开发总结的技术经验60条
- Android中第三方控件PhotoView的基本使用
- android 自定义Viewpager实现无限循环
- Android Studio下运行开源项目9GAG遇到的问题
- Android中Parcelable接口用法
- Android Studio 打包APK
- android 录音绘制波形
- android 线程框架
- Android4.0.x Home键事件拦截监听的方法
- android 使用内容提供者获取手机联系人
- Can not perform this action after onSaveInstanceState
- [Android] AS 中 Gradle 配置运行浅析