Android启动画面的实现方法
作者:shichen2014 发布时间:2023-12-27 23:22:11
标签:Android,启动,画面
本文实例讲述了Android启动画面的实现方法。分享给大家供大家参考。具体分析如下:
在应用程序中经常用到启动画面,会启动一个后台线程为主程序的运行准备资源。
Android要实现启动画面可以这样做:
这是splash.xml布局文件的代码:
<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>
放一个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程序设计有所帮助。
0
投稿
猜你喜欢
- Lombok有什么用在我们实体Bean中有大量的Getter/Setter方法以及toString, hashCode等可能不会用到,但是某
- 本文实例为大家分享了android绘制曲线和折线图的具体代码,供大家参考,具体内容如下(曲线) (折线)1.CurveView.j
- 在项目中为了友好化,对于错误页面,我们常常会使用自定义的页面。SSM框架组合时代,我们通常通过拦截或者在web.xml中设置对于错误码的错误
- 在新版的AndroidStudio3.6 中,在项目的包下新建 activity 时,一般会同时生成对应的java和xml文件,例如新建 M
- 前言结果映射指的是将数据表中的字段与实体类中的属性关联起来,这样 MyBatis 就可以根据查询到的数据来填充实体对象的属性,帮助我们完成赋
- Java BlockingQueue接口java.util.concurrent.BlockingQueue表示一个可以存取元素,并且线程安
- 本文实例为大家分享了Unity3D实现物体排成弧行的具体代码,供大家参考,具体内容如下一般用在Pico、HTC、DP等VR设备中效果:完整代
- 去年买了本数字图像处理算法,一直都没有看,前几个星期都一直忙着工作上的活,趁这阶段悠闲点,玩一玩图片处理,这玩意还是非常有意思的。以前我们在
- namespace PadWebServices.Model{ public static class DataTa
- 背景:以前学的Java进行开发,多用到Mybatis,Hiberante等ORM框架,最近需要上手一个C#的项目,由于不是特别难,也不想再去
- Kotlin 面向对象这几天一直在准备考试,实在没有时间,已经过去了这么久,终于要到面向对象了!先看看Kotlin中的类长什么样吧.可以看到
- 基本环境:Android studio3.6NDK:r15c(尽量使用该版本)Opencv3.4.1 android sdk操作:(1)新建
- Java 是一门面向对象的编程语言,面向对象的编程语言有四大特征:抽象、封装、继承和多态。而本文介绍的接口和抽象类就是面向对象编程中“抽象”
- 本例为模仿微信聊天界面UI设计,文字发送以及语言录制UI。1先看效果图: 第一:chat.xml设计 &l
- 有时候数据库文档需要整理,可是只能手动的复制粘贴,心中一万只草泥马奔腾而过。。。screw简洁好用的数据库表结构文档生成工具。1. 创建项目
- 在讲策略模式之前,我先给大家举个日常生活中的例子,从首都国际机场到XXX酒店,怎么过去?1)酒店接机服务,直接开车来接。2)打车过去。3)机
- 本文实例讲述了WinForm调用jar包的方法。分享给大家供大家参考,具体如下:因为工作需要,需要做一个数据上传的程序,客户规定的是:数据接
- 使用工具:IDEA2022Tomcat9.0.41.下载Tomcat:官网:https://tomcat.apache.org/找到需要的版
- 1. 使用蓝牙的响应权限<uses-permission android:name="android.permission.
- 作为一个初级GIS程序员,关于封装那些宏观的概念暂且不提,编程经常面对的就是“字段,属性,方法”,这也是面向对象的基本概念之一。1.字段通常