不同颜色的按钮字体
Button font in difference color
我正在尝试将按钮样式更改为下图。最后,我只是使用 gridlayout 来显示我想要的设计。是不是可以使用按钮显示下图相同的设计?
<GridLayout rows="auto" columns="auto, auto" backgroundColor="#ffffff" padding="10" borderWidth="0.2" borderColor ="#E7E7E7" tap="onClick" id="btnTG" matchId="{{ SLMatchId }}" dataType="odd_0" tap="onBtnClick">
<label text="{{ 0 + ' '}}" color="red" fontWeight = "bold" id="lblTG1"/>
<label text="{{ OddsList.TG0 }}" col="1" id="lblTG2"/>
</GridLayout>
我发现 formattedText 属性可以应用。但是我尝试后发现 Button 组件字体不能改变颜色。没有什么编码错误吗?
<Button col="3" backgroundColor="#ffffff" paddingTop="10" borderWidth="0.2" borderColor ="#E7E7E7" paddingBottom="10" matchId="{{ SLMatchId }}" paddingLeft="7" id="btnTG" dataType="odd_UP7" tap="onBtnClick">
<Button.formattedText>
<FormattedString>
<FormattedString.spans>
<Span text="{{ 0 + ' '}}" foregroundColor="#D93F3F" />
<Span text="{{ 13.00 }}" />
</FormattedString.spans>
</FormattedString>
</Button.formattedText>
它对我有用:
<Button>
<FormattedString>
<Span
text="'0 '"
fontAttributes="Bold"></Span>
<Span
text=" 13.00"></Span>
</FormattedString>
</Button>
我正在尝试将按钮样式更改为下图。最后,我只是使用 gridlayout 来显示我想要的设计。是不是可以使用按钮显示下图相同的设计?
<GridLayout rows="auto" columns="auto, auto" backgroundColor="#ffffff" padding="10" borderWidth="0.2" borderColor ="#E7E7E7" tap="onClick" id="btnTG" matchId="{{ SLMatchId }}" dataType="odd_0" tap="onBtnClick">
<label text="{{ 0 + ' '}}" color="red" fontWeight = "bold" id="lblTG1"/>
<label text="{{ OddsList.TG0 }}" col="1" id="lblTG2"/>
</GridLayout>
我发现 formattedText 属性可以应用。但是我尝试后发现 Button 组件字体不能改变颜色。没有什么编码错误吗?
<Button col="3" backgroundColor="#ffffff" paddingTop="10" borderWidth="0.2" borderColor ="#E7E7E7" paddingBottom="10" matchId="{{ SLMatchId }}" paddingLeft="7" id="btnTG" dataType="odd_UP7" tap="onBtnClick">
<Button.formattedText>
<FormattedString>
<FormattedString.spans>
<Span text="{{ 0 + ' '}}" foregroundColor="#D93F3F" />
<Span text="{{ 13.00 }}" />
</FormattedString.spans>
</FormattedString>
</Button.formattedText>
它对我有用:
<Button>
<FormattedString>
<Span
text="'0 '"
fontAttributes="Bold"></Span>
<Span
text=" 13.00"></Span>
</FormattedString>
</Button>