当前位置:网站首页>一招快速实现自定义快应用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
边栏推荐
猜你喜欢

STM32 and motor development (upper system)
![2. Hacking lab script off [detailed writeup]](/img/f3/29745761cd5ad4df84c78ac904ea51.png)
2. Hacking lab script off [detailed writeup]

从.bag文件中读取并保存.jpg图片和.pcd点云

Disassembling Meitu SaaS: driving the plane to change the engine

2022爱分析· 国央企数字化厂商全景报告

The nanny level tutorial of flutter environment configuration makes the doctor green to the end

【AppLinking实战案例】通过AppLinking分享应用内图片
![2.hacking-lab脚本关[详细writeup]](/img/f3/29745761cd5ad4df84c78ac904ea51.png)
2.hacking-lab脚本关[详细writeup]

《实习报告》Skywalking分布式链路追踪?

Redis set password
随机推荐
互联网快讯:腾讯会议应用市场正式上线;Soul赴港递交上市申请书
2022爱分析· 国央企数字化厂商全景报告
Is this code PHP MySQL redundant?
Easyexcel, a concise, fast and memory saving excel processing tool
"Matching" is true love, a new attitude for young people to make friends
HDU1228 A + B(map映射)
Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
Ks009 implement pet management system based on SSH
1287_FreeRTOS中prvTaskIsTaskSuspended()接口实现分析
13.信号量临界区保护
[Lua] summary of common knowledge points (including common interview sites)
长投学堂上面的账户安全吗?
UWA报告使用小技巧,你get了吗?(第四弹)
Mysql database remote access permission settings
全网显示 IP 归属地,是怎么实现的?
Shell programming 01_ Shell foundation
SQOOP 1.4.6 INSTALL
转换YV12到RGB565图像转换,附YUV转RGB测试
Win11 arm系统配置.net core环境变量
MYSQL环境配置