我为项目中的每个标签都使用了标签类。如果还有其他字体颜色,例如
应用class =“ label font-clr-green”
则它不呈绿色。因此,我决定覆盖app.css中的label类,但这也是失败的。我需要知道标签类是否可以被覆盖。
答案 0 :(得分:0)
我检查了您的Playground示例,并从中得出的结论是,问题部分使用的<Label>
没有采用应有的绿色。嗯,那是因为您正在<Label>
类<StackLayout>
中使用这个input-field
元素。看来.input-field Label
的CSS是预先定义的。
解决您的问题的方法是将此类input-field
重命名为其他名称。仅此而已。以下是更新的XML部分。您还可以通过修复程序检查我随附的Playground演示。
<Page loaded="pageLoaded" class="page" xmlns="http://www.nativescript.org/tns.xsd">
<ActionBar title="Home" class="action-bar">
</ActionBar>
<ScrollView>
<StackLayout class="form">
<!--this was working fine -->
<Label textWrap="true" text="Play with NativeScript!" class="label font-weight-bold m-b-5 fcg" />
<Label textWrap="true" text="Play with NativeScript!" class="label font-weight-bold m-b-5"
color="green" />
<!-- the problem was here, solution was to rename input-field to input-field-1 -->
<StackLayout class="input-field-1">
<StackLayout class="okay">
<Label text="Active Flag" class="label font-weight-bold m-b-5 fcg" />
</StackLayout>
<Switch checked="true" class="switch fcg"
horizontalAlignment='left' margin="0" />
<StackLayout class="hr-light"></StackLayout>
</StackLayout>
</StackLayout>
</ScrollView>