Xamarin 表单更改 SwichCell 文本颜色
本文关键字:文本 颜色 SwichCell 表单 Xamarin | 更新日期: 2023-09-27 17:56:28
是否可以更改 xamarins SwichCell 的文本颜色?
目前,我的SwichCell中的文本是灰色的,我想将其更改为黑色。
我的 xaml 如下所示:
..
<TableView Intent="Data" >
<TableRoot>;
<TableSection>
<SwitchCell Text="Allow Push Notifications"/>
</TableSection>
<TableSection>
<ViewCell>
<ViewCell.View>
<Button Grid.Column="1" Text="Log Out" Clicked="LogOutButtonClick" Margin="-20,-20,-20,-20"/>
</ViewCell.View>
</ViewCell>
</TableSection>
<TableSection>
<TextCell Text="Android Version 1.2.1" TextColor="Black"/>
</TableSection>
</TableRoot>
</TableView>
我在这里找到的唯一关于此的事情,但示例仅适用于IOS,其他提供的解决方案使用TextCell和Swich组合,这不适合我的情况(我认为)
有人在这里链接了一个关于Swich的堆栈溢出答案。但它对我的情况不起作用,因为我使用的是 SwichCell 并且它没有该答案中列出的属性(它也只有一个安卓版本)
如果 SwitchCell 未公开 BackgroundColor 属性,则只需将 Switch 控件包装在其自己的 ViewCell 中即可。
无法确认语法,但像这样:
<ViewCell>
<StackLayout>
<Switch BackgroundColor="Black"/>
</StackLayout>
</ViewCell>