Android启动画面实现
来源:互联网 发布:json数组解析 编辑:程序博客网 时间:2024/04/28 23:30
在应用程序中经常用到启动画面,会启动一个后台线程为主程序的运行准备资源。
Android要实现启动画面可以这样做:
这是splash.xml布局文件的代码[code]<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical">
<ImageView android:layout_height="fill_parent" android:layout_width="fill_parent" android:scaleType="fitCenter" android:src="@drawable/splash"></ImageView>
</LinearLayout>[/code]
放一个ImageView加载启动画面图片
SplashActivity作为主视图启动/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Handler x = new Handler();
x.postDelayed(new splashhandler(), 2000);
}
class splashhandler implements Runnable{
public void run() {
startActivity(new Intent(getApplication(),MainActivity.class));
SplashActivity.this.finish();
}
}
Android要实现启动画面可以这样做:
这是splash.xml布局文件的代码[code]<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="fill_parent" android:layout_width="fill_parent" android:orientation="vertical">
<ImageView android:layout_height="fill_parent" android:layout_width="fill_parent" android:scaleType="fitCenter" android:src="@drawable/splash"></ImageView>
</LinearLayout>[/code]
放一个ImageView加载启动画面图片
SplashActivity作为主视图启动/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
Handler x = new Handler();
x.postDelayed(new splashhandler(), 2000);
}
class splashhandler implements Runnable{
public void run() {
startActivity(new Intent(getApplication(),MainActivity.class));
SplashActivity.this.finish();
}
}
0 0
- Android启动画面实现
- Android启动画面实现
- Android启动画面实现
- Android实现启动画面
- Android启动画面实现
- Android启动画面实现
- Android启动画面实现
- Android启动画面实现
- Android启动画面实现
- Android启动画面实现
- Android启动画面实现
- Android启动画面实现
- Android启动画面实现
- Android启动画面实现
- Android启动画面实现
- Android启动画面的实现
- android程序启动画面实现
- Android应用启动画面实现
- 利用qmake来为15.04及以上target创建Ubuntu应用项目
- angularjs中取出服务器返回的header中的数据。
- 解决问题方式的转变2
- 安装pmd
- fork()与_syscall0(int,fork) 关系
- Android启动画面实现
- 我的OpenCV学习笔记(11):启动摄像头
- R语言学习笔记-数据操作
- Dundas推出AWS上的大数据可视化解决方案
- Cocos2d-X3.0 ----- 内存管理源码分析
- 回车换行的不同以及 转义字符和ASCII码值—(附ASCII码表)
- Android启动画面实现
- 线程的4中状态
- 【leetcode with java】32 Longest Valid Parentheses O(n)