当前位置:网站首页>一招快速实现自定义快应用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系统可用性量表
- Oracle notes
- How to get the password of cpolar?
- Database dictionary Navicat automatic generation version
- Pywin32 opens the specified window
- Introduction to MySQL 8 DBA foundation tutorial
- 618再次霸榜的秘密何在?耐克最新财报给出答案
- nodejs+express+mysql简单博客搭建
- Jsp webshell Free from killing - The Foundation of JSP
- LeetCode+ 76 - 80 暴搜专题
猜你喜欢
Sus system availability scale
Mysql database remote access permission settings
对话吴纲:我为什么笃信“大国品牌”的崛起?
数据库字典Navicat自动生成版本
Use WinDbg to statically analyze dump files (summary of practical experience)
软件产品管理系统有哪些?12个最佳产品管理工具盘点
Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
UVM learning - build a simple UVM verification platform
[visual studio] visual studio 2019 community version cmake development environment installation (download | install relevant components | create compilation execution project | error handling)
Disassembling Meitu SaaS: driving the plane to change the engine
随机推荐
[SUCTF2018]followme
The nanny level tutorial of flutter environment configuration makes the doctor green to the end
高考的意义是什么
Mongodb quickly get started with some simple operations of mongodb command line
SQOOP 1.4.6 INSTALL
What is the significance of the college entrance examination
js promise.all
1287_ Implementation analysis of prvtaskistasksuspended() interface in FreeRTOS
4.随机变量
大华设备播放过程中设置播放速度
记录 AttributeError: ‘NoneType‘ object has no attribute ‘nextcall‘
面对不确定性,供应链的作用
2. Hacking lab script off [detailed writeup]
UWA report uses tips. Did you get it? (the fourth bullet)
12. Process synchronization and semaphore
P1055 [noip2008 popularization group] ISBN number
13. Semaphore critical zone protection
对话吴纲:我为什么笃信“大国品牌”的崛起?
6种单例模式的实现方式
从MediaRecord录像中读取H264参数