From 0d3272190a13f71402c92d869fda88df45816f25 Mon Sep 17 00:00:00 2001 From: mkno1412222222 <12436341+mkno1412222222@user.noreply.gitee.com> Date: Wed, 30 Jul 2025 03:29:08 +0000 Subject: [PATCH] add ArkUI/entry/src/main/ets/pages/CustomTitleInNavigation.ets. Signed-off-by: mkno1412222222 <12436341+mkno1412222222@user.noreply.gitee.com> --- .../ets/pages/CustomTitleInNavigation.ets | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 ArkUI/entry/src/main/ets/pages/CustomTitleInNavigation.ets diff --git a/ArkUI/entry/src/main/ets/pages/CustomTitleInNavigation.ets b/ArkUI/entry/src/main/ets/pages/CustomTitleInNavigation.ets new file mode 100644 index 0000000..069ba0f --- /dev/null +++ b/ArkUI/entry/src/main/ets/pages/CustomTitleInNavigation.ets @@ -0,0 +1,66 @@ +/* +* Copyright (c) 2025 Huawei Device Co., Ltd. +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ + +/* +* FAQ:Navigation自定义标题栏不生效 +*/ + +// [Start navigationcustomtitle_example] +@Entry +@Component +export struct MainPage { + myTitle: NavigationCustomTitle = { + builder: this.customTitleBuilder.bind(this), + height: TitleHeight.MainOnly + }; + + @Builder + customTitleBuilder() { + Row() { + Text('标题1') + .fontSize(12) + .fontWeight(FontWeight.Bold) + .margin({ left: 7, right: 7, top: 7 }) + + Text('标题2') + .fontSize(12) + .fontWeight(FontWeight.Bold) + .margin({ left: 7, right: 7, top: 7 }) + + Text('标题3') + .fontSize(12) + .fontWeight(FontWeight.Bold) + .margin({ left: 7, right: 7, top: 7 }) + } + } + + build() { + Navigation() { + Column() { + Text('hello world') + .fontSize('24') + .fontWeight(FontWeight.Bold) + .fontFamily('HarmonyHeiTi-Bold') + .textAlign(TextAlign.Center) + .width('100%') + } + .height('100%') + .width('100%') + .background('#F1F3F5') + } + .title(this.myTitle) + } +} +// [End navigationcustomtitle_example] \ No newline at end of file -- Gitee