美文网首页
Android安全卫士-欢迎界面

Android安全卫士-欢迎界面

作者: 落萚 | 来源:发表于2017-10-17 09:55 被阅读0次

设置完App图标接下来设置App的欢迎界面
在你创建完SplashActivity后在res/layout目录下会自动生成一个activity_splash.xml,这个就是欢迎界面对应的布局文件
首先将欢迎界面的图片文件复制粘贴到res/drawable目录下,再写布局文件

activity_splash.xml
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:background="@drawable/launch_bg">
    <ProgressBar
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true"
        android:id="@+id/pb_splash_loading"/>
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:id="@+id/tv_splash_version"
        android:text="version:1.0"
        android:layout_below="@+id/pb_splash_loading"/>
</RelativeLayout>

ProgressBar

ProgressBar有几种类型,此处我们使用最普通的类型,样式就是一个一直在转的进度圈

match_parent和wrap_content是比较常用的两个布局属性,match_parent可以理解为填满剩余空间的意思,而wrap_content可以理解为大小取决于内容

然后进行垂直居中和水平居中就把ProgressBar放到了一个比较合适的位置

TextView

TextView就是放一段文字,layout_below的意思是将当前控件放在指定id控件的下面,在此处就是将App的版本号放在进度圈下方

此时运行出来的效果如下

欢迎界面

相关文章

网友评论

      本文标题:Android安全卫士-欢迎界面

      本文链接:https://www.haomeiwen.com/subject/slpruxtx.html