首页 > 解决方案 > 如何使用 nativescript angular 和主题生成器设置 tabItem 样式?

问题描述

我使用标签导航模板创建了 Nativescript Angular 应用程序。该模板创建了以下内容app.component.html

<TabView androidTabsPosition="bottom" class="tab-view">

    <page-router-outlet
        *tabItem="{title: 'People', iconSource: getIconSource('home')}"
        name="homeTab">
    </page-router-outlet>

    <page-router-outlet
        *tabItem="{title: 'Events', iconSource: getIconSource('search')}"
        name="browseTab">
    </page-router-outlet>

    <page-router-outlet
        *tabItem="{title: 'Tags', iconSource: getIconSource('browse')}"
        name="searchTab">
    </page-router-outlet>

</TabView>

我在https://www.nativescriptthemebuilder.com/.css使用主题生成器创建了文件,该文件生成了这部分:

.tab-view {
    selected-tab-text-color: #ffffff;
}

.tab-view {
    tab-text-color: #ffffff;
}

.tab-view {
    tab-background-color: #823551;
}

.tab-view {
    android-selected-tab-highlight-color: #d6c7d1;
}

有将 CSS 类添加到本机元素的说明,所以我添加了tab-view类,如您在第一个片段中看到的那样。但是选项卡的文本颜色和所选选项卡的文本颜色不会更改,并且与主题生成器的颜色不匹配。我发现的所有示例都是用于xml视图或不使用*tabItem指令。

因此,要么 Nativescript 的主题构建器不适用于 Nativescript 自己的应用程序模板,要么我做错了什么。我是否忘记或错过了此配置中的某些内容?

标签: nativescriptangular2-nativescript

解决方案


推荐阅读