Android:如何为APP添加满屏启动页
来源:互联网 发布:路由器网络不稳定 编辑:程序博客网 时间:2024/05/16 05:49
1、首先,我们创建一个布局splash.xml;
<?xml version="1.0" encoding="utf-8"?><LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <ImageView android:layout_width="fill_parent" android:layout_height="fill_parent" android:scaleType="fitXY" android:src="@drawable/splash"> </ImageView></LinearLayout>
2、再者,创建一个新类SplashActivity.java;
public class SplashActivity extends Activity {@Overrideprotected void onCreate(Bundle savedInstanceState) {// TODO Auto-generated method stubsuper.onCreate(savedInstanceState);requestWindowFeature(Window.FEATURE_NO_TITLE);getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);setContentView(R.layout.splash);Handler hd = new Handler(); hd.postDelayed(new splashhandler(), 800);}class splashhandler implements Runnable {public void run() {startActivity(new Intent(getApplication(), MainActivity.class));SplashActivity.this.finish();}}}
<activity android:name="x.x.x.SplashActivity" android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|orientation|screenLayout|uiMode|screenSize|smallestScreenSize|fontScale" android:label="@string/app_name" android:launchMode="singleTask" android:screenOrientation="landscape" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> <category android:name="android.intent.category.LEANBACK_LAUNCHER" /> </intent-filter> </activity>
最后不要忘了要首屏的图片资源drawable/splash.png;
综上,我们APP的启动页已经做好了。
0 0
- Android:如何为APP添加满屏启动页
- 如何优雅的为你的app添加启动引导页
- 如何为Android Studio 添加快速启动方式【Linux】
- 如何快速启动android app
- Android 为某个App 添加/移除 启动快捷方式、书签快捷方式、应用市场快捷方式
- 如何添加Tomcat为启动服务
- 如何为Gnome3添加自启动程序
- 如何为Gnome3添加自启动程序
- HcdGuideView让你为你的app添加一个漂亮的启动页变得简单。
- app如何添加引导页。
- 为Android添加开机启动脚本
- 为Android应用程序添加Splash启动画面
- 为Android添加开机启动脚本
- 为Android添加开机启动脚本
- (OK) 为Android添加开机启动脚本
- 为Android添加开机启动脚本
- 为Android添加开机启动脚本
- android app如何做到快速启动
- Oracle设置和删除归档日志
- 40个Java多线程问题总结
- [转载]辨析access_ok put_user __put_user get_user __get_user
- Type mismatch: cannot convert from Integer to int(java 报错)
- 普通程序员通向架构师的最佳路径?
- Android:如何为APP添加满屏启动页
- [leetcode] 238. Product of Array Except Self 解题报告
- 关于资源的Reference路径引用下,文件的使用
- mybatis之mysql&oracle 批量操作
- InfoPath表单每增加一个表单产生一个自动增加ID序号
- 程序员必须知道的几个Git代码托管平台
- Xcode编译Undefined symbols for architecture xxx 错误总结
- 29. 在magento CMS中的标签变量使用
- 纯css3实现点击缩略图切换背景图