使用标签更改颜色文本
Change color text using Label
使用 Label
Nativescript 时如何更改菜单栏上的文本颜色。
我的代码:
<StackLayout row="1" orientation="horizontal" backgroundColor="#eae8e8" class="foot">
<Label width="25%" textAlignment="left" [nsRouterLink]="['/photos']">
<FormattedString>
<Span text="Photos"></Span>
</FormattedString>
</Label>
<Label width="25%" textAlignment="left" [nsRouterLink]="['/albums']">
<FormattedString>
<Span text="Albums"></Span>
</FormattedString>
</Label>
</StackLayout>
我想要这样当点击
您可以在 CSS 和直接 HTML 中使用 color
属性来指定元素的颜色。
例如:
zontal" backgroundColor="#eae8e8" class="foot">
<Label width="25%" textAlignment="left" [nsRouterLink]="['/photos']">
<FormattedString>
<Span color="blue" text="Photos"></Span>
</FormattedString>
</Label>
<Label width="25%" textAlignment="left" [nsRouterLink]="['/albums']">
<FormattedString>
<Span text="Albums"></Span>
</FormattedString>
</Label>
</StackLayout>
这是游乐场演示:https://play.nativescript.org/?template=play-ng&id=gMhuwo&v=2
使用 Label
Nativescript 时如何更改菜单栏上的文本颜色。
我的代码:
<StackLayout row="1" orientation="horizontal" backgroundColor="#eae8e8" class="foot">
<Label width="25%" textAlignment="left" [nsRouterLink]="['/photos']">
<FormattedString>
<Span text="Photos"></Span>
</FormattedString>
</Label>
<Label width="25%" textAlignment="left" [nsRouterLink]="['/albums']">
<FormattedString>
<Span text="Albums"></Span>
</FormattedString>
</Label>
</StackLayout>
我想要这样
您可以在 CSS 和直接 HTML 中使用 color
属性来指定元素的颜色。
例如:
zontal" backgroundColor="#eae8e8" class="foot">
<Label width="25%" textAlignment="left" [nsRouterLink]="['/photos']">
<FormattedString>
<Span color="blue" text="Photos"></Span>
</FormattedString>
</Label>
<Label width="25%" textAlignment="left" [nsRouterLink]="['/albums']">
<FormattedString>
<Span text="Albums"></Span>
</FormattedString>
</Label>
</StackLayout>
这是游乐场演示:https://play.nativescript.org/?template=play-ng&id=gMhuwo&v=2