前言

大家好,给大家带来Android-如何显示版本号并制作3秒跳转页的概述,希望你们喜欢

软件技术人员,时代作者,从 Android 到全栈之路,我相信你也可以!阅读他的文章,会上瘾!You and me, we are family !

创建布局文件

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:background="@drawable/launch_bg">
<TextView
android:id="@+id/tv_version"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:textColor="@android:color/white"
android:textSize="14sp"/>
<RelativeLayout>

创建一个版本Activity类

public class SplashActivity extends AppCompatActivity{
private TextView textView;
@Override
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_splash); setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
textView = findViewById(R.id.tv_version); try{
PackageInfo info = getPackageManager().getPackageInfo(getPackageName(),0);
textView.setText("version:"+info.versionName);
}catch(PackageManger.NameNotFoundException e){
e.printStackTrace();
} Timer timer = new Timer();
TimerTask timerTask = new TimeTask(){
@Override
public void run(){
Intent intent = new Intent(SplashActivity.this,MainActivity.class);
startActivity(intent);
SplashActivity.this.finish();
}
};
timer.schedule(timerTask,3000);
}
}

在清单文件中,添加声明即可。

总结

  • 本文讲了Android-如何显示版本号并制作3秒跳转页,如果您还有更好地理解,欢迎沟通
  • 定位:分享 Android&Java知识点,有兴趣可以继续关注

Android-如何显示版本号并制作3秒跳转页的更多相关文章

  1. Android应用程序版本号管理(官方文档中文版)

    在应用程序的 升级/维护 策略中, 版本是一个关键的组成部分. 用户需要了解在他们的设备上所安装的应用程序的版本的特定信息, 以及已安装程序的升级版本可用的情况. 其他应用程序 - 作为同一个套件中发 ...

  2. Android:res之shape制作圆角、虚线、渐变

    xml控件配置属性 android:background="@drawable/shape" 标签 corners ----------圆角gradient ----------渐 ...

  3. Android ImageView显示本地图片

    Android ImageView 显示本地图片 布局文件 <?xml version="1.0" encoding="utf-8"?> <R ...

  4. unity,将camera设为don't clear在android上会显示不正常

    将camera设置为don't clear,在pc和ios上显示没问题,但在android上显示不正常,改为only depth可以.

  5. Android中显示网页的多种方式

    在android中显示页面主要有两种方式,一种是在Activity里面直接显示网页,另一种是调用浏览器显示网页.方式不同,使用的方法也不同,下面我们分别讲解. 一.在Activity里面直接显示网页 ...

  6. apache nginx php不显示版本号

    apache 不显示版本号 http.conf 中的 修改为 ServerTokens ProdServerSignature Off 有的版本没有,在最后添加即可 php php.ini 中的 修改 ...

  7. android recovery模式及ROM制作

    转自android recovery模式及ROM制作 1.总述 为了方便客户日后的固件升级,本周研究了一下android的recovery模式.网上有不少这类的资料,但都比较繁杂,没有一个系统的介绍与 ...

  8. app开发历程——android手机显示服务器端图片思路

    以前自己都不知道怎么去显示服务器端的图片,还好在apkbus论坛上找到一个特别简单的例子.虽然一天天忙忙碌碌,但是自己内心其实有一种想逃的心里,说不定哪天就会冒出来. 1.首先服务器端图片 这里的Im ...

  9. Android系统各版本号及代号

    Android系统各版本号及代号 版本 版本号代号 公布日期 API Android 1.0 阿童木 1 Android 1.1 发条机器人 2008.9 2 Android 1.5 纸杯蛋糕 200 ...

随机推荐

  1. input设置背景透明、placeholder的字体颜色及大小

    1.设置input背景透明: background:rgba(255,255,255,0.1); 前面三个参数为对应的rgb数值,第四个参数为透明度:0~1,0:透明,1:不透明: 2.设置input ...

  2. Array.prototype.push.apply(a,b)和Array.prototype.slice.call(arguments)

    Array.prototype.push.apply(a,b) 时常看到在操作数组的时候有这样的写法: var a = [1,2,3]; var b = [4,5,6]; a.push.apply(a ...

  3. Java学习笔记(十四):java常用的包

  4. springboot和mybatis之thymleaf整合简单插入用户数据

    编写mapper接口和对应的mapper.xml文件,注意对应的注解 @Mapper @Repository public interface StudentMapper { void insertS ...

  5. Block学习总结

    最近网上浏览了一些关于Block的文章,自己进行一下消化吸收. Void (^blockName)(parma)-> Block声明 Void (^) (parma){};  ->Bloc ...

  6. HDU 5723 Abandoned country(kruskal+dp树上任意两点距离和)

    Problem DescriptionAn abandoned country has n(n≤100000) villages which are numbered from 1 to n. Sin ...

  7. 796. Rotate String旋转字符串

    [抄题]: We are given two strings, A and B. A shift on A consists of taking string A and moving the lef ...

  8. linux resin 基本站点配置

    进入配置文件目录: [root@linuxidc resin-]# cd /usr/local/resin/conf/ 查看都有哪些配置文件: [root@linuxidc conf]# ls app ...

  9. android 设置LOGO和app名称

    mipmap和drawable目录都可以存放图片,一般情况下,将LOGO文件存放在mipmap目录,普通图片放到drawable目录. 一.在mipmap目录添加LOGO图片 在mipmap目录右键- ...

  10. SQL笔试基础

    SQLSERVER服务器中,给定表table1 中有两个字段 ID.LastUpdateDate,ID表示更新的事务号,LastUpdateDate表示更新时的服务器时间,请使用一句SQL语句获得最后 ...