autojs之启动页

启动页概念

启动页包括开屏页和广告页,
桌面点击app, 你看见的第一个页面就是开屏页;
开屏页后面可以显示广告页, 也可以不显示
本节教程针对开屏页

效果展示

在这里插入图片描述

autojs版本

在这里插入图片描述

软件自带示例

在这里插入图片描述


自定义启动页

自定义启动页需要在project.json中配置"splashLayoutXml"参数

并创建自定义启动图的xml,本项目为splash.xml

xml中只能为静态控件等,不能有js代码或list等动态控件


project.json

project.json文件用于配置项目的相关参数,比如主文件、启动图、包名等信息。

主要功能是表示该文件夹是一个autojs项目


splashLayoutXml

project.json有一个字段launchConfig, 功能: 打包后的相关启动配置。

launchConfig有一个字段splashLayoutXml, 功能: 启动图xml,用于打包后自定义启动图(8.5以上版本)

splashLayoutXml示例

<?xml version="1.0" encoding="UTF-8"?>
<vertical>
	<frame gravity="center" height="match_parent" width="match_parent" background="#000000">
		<img src="file://./splash.jpeg" scaleType="fitCenter" />
		<RelativeLayout height="match_parent" width="match_parent">
			<frame layout_centerHorizontal="true" layout_alignParentBottom="true" gravity="center" background="#cc000000">
				<text text="牙叔" layout_width="wrap_content" layout_height="wrap_content" textSize="45" textColor="#8BC34A" textStyle="bold" margin="24" />
			</frame>
		</RelativeLayout>
	</frame>
</vertical>

该布局是一个frame布局, 全屏显示一张图片, 图片底部显示一些文字

效果如下

在这里插入图片描述

最小的自定义启动页project.json

{
  "name": "自定义启动页",
  "launchConfig": {
    "splashLayoutXml": "splash.xml"
  },
  "main": "main.js",
  "ignore": ["build"],
  "packageName": "com.yashu",
  "versionName": "1.0.0",
  "versionCode": 1
}

查看完整项目


微信公众号 AutoJsPro教程

在这里插入图片描述

QQ群

747748653

在这里插入图片描述

评论 3
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

牙叔教程

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值