背景
快應用中系統自帶的titleBar是默認在左邊的,且是無法進行自定義的,開發者在開發過程中遇到的需求是顯示在頂部的正中間,而不是左邊。本文旨在幫助開發者實現自定義titleBar。
實現步驟
自定義titleBar實現分爲兩步。
1、manifest.json文件裏設爲titleBar屬性設置爲false,隱藏系統自帶的titeBar。
2、實現自定義titleBar,使用一個text組件,並使其居中顯示即可。
效果圖:
欲瞭解更多詳情,請參見快應用manifest文件介紹:
https://developer.huawei.com/consumer/cn/doc/development/quickApp-Guides/quickapp-develop-deeplink