当前位置:网站首页>一招快速实现自定义快应用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
边栏推荐
- 华为游戏初始化init失败,返回错误码907135000
- 2022-06-17
- UVM factory mechanism
- Start class, data analysis, high salary training plan, elite class
- [SUCTF2018]followme
- JSP webshell免杀——JSP的基础
- 618再次霸榜的秘密何在?耐克最新财报给出答案
- [Lua] summary of common knowledge points (including common interview sites)
- Flutter——Canvas自定义曲线图
- 记录 AttributeError: ‘NoneType‘ object has no attribute ‘nextcall‘
猜你喜欢

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

软件产品管理系统有哪些?12个最佳产品管理工具盘点

618再次霸榜的秘密何在?耐克最新财报给出答案

How to get the password of cpolar?

UVM learning - object attribute of UVM phase

12. Process synchronization and semaphore

MySQL数据库远程访问权限设置

KS009基于SSH实现宠物管理系统

Is this code PHP MySQL redundant?

Solutions to a series of problems in sqoop job creation
随机推荐
从.bag文件中读取并保存.jpg图片和.pcd点云
【AppLinking实战案例】通过AppLinking分享应用内图片
axis设备的rtsp setup头中的url不能带参
Considerations for Apache deploying static web page projects
MySQL keyword
Lunix reallocates root and home space memory
Is this code PHP MySQL redundant?
12. Process synchronization and semaphore
Flink submitter
SUS系统可用性量表
AI技术产业热点分析
6种单例模式的实现方式
Session cookies and tokens
MYSQL环境配置
HDU1236 排名(结构体排序)
Read H264 parameters from mediarecord recording
Jsp webshell Free from killing - The Foundation of JSP
[Lua] summary of common knowledge points (including common interview sites)
Windows环境MySQL8忘记密码文件解决方案
集成学习概览