当前位置:网站首页>一招快速实现自定义快应用titlebar
一招快速实现自定义快应用titlebar
2022-07-02 07:16:00 【华为开发者论坛】
背景
快应用中系统自带的titleBar是默认在左边的,且是无法进行自定义的,开发者在开发过程中遇到的需求是显示在顶部的正中间,而不是左边。本文旨在帮助开发者实现自定义titleBar。
实现步骤
自定义titleBar实现分为两步。
1、manifest.json文件里设为titleBar属性设置为false,隐藏系统自带的titeBar。
"display": {
"titleBar": false,
"pages": {
"Hello": {
"statusBarBackgroundColor": "#0faeff"
}
}
}
2、实现自定义titleBar,使用一个text组件,并使其居中显示即可。
<template>
<!-- Only one root node is allowed in template. -->
<div class="container">
<text class="txt">titlebar</text>
<div class="label">
<text style="font-size: 60px">this is test page</text>
</div>
</div>
</template>
<style>
.container {
flex-direction: column;
align-items: center;
}
.txt {
font-size: 60px;
color: #00ced1;
margin-top: 15px;
}
.label {
flex-direction: column;
justify-content: center;
width: 100%;
height: 100%;
}
</style>
<script>
module.exports = {
data: {
status: 1
},
onInit() {
},
onShow(options) {
'// Do something when show.'
},
}
</script>
效果图:
欲了解更多详情,请参见快应用manifest文件介绍:
https://developer.huawei.com/consumer/cn/doc/development/quickApp-Guides/quickapp-develop-deeplink
边栏推荐
猜你喜欢
随机推荐
SUS系统可用性量表
快速做出原型
[Fantasy 4] introduction and use of UMG components (under update...)
2022-06-17
Mongodb quickly get started with some simple operations of mongodb command line
axis设备的rtsp setup头中的url不能带参
C#中索引器
UVM learning - object attribute of UVM phase
Oracle 笔记
使用华为性能管理服务,按需配置采样率
从.bag文件中读取并保存.jpg图片和.pcd点云
02-taildir source
大华设备播放过程中设置播放速度
sqoop的表的导入
全网显示 IP 归属地,是怎么实现的?
PCL之K-d树与八叉树
华为游戏初始化init失败,返回错误码907135000
Kustomize使用手册
shell编程01_Shell基础
01-spooldir