xamarin.forms - 如何将 CSS 样式应用于 TextCell 并更改 TextColor
问题描述
我想用 CSS 样式更改ListView中TextCell的TextColor 。
我尝试了以下方法,但颜色保持不变:
MenuPage TextCell {
color: aqua;
textcolor: aqua;
text-color: aqua;
TextColor: aqua;
}
解决方案
我对 TextCell 没有运气。但是,如果您可以将其设为 ViewCell 中的标签:
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout>
<Label Text="{Binding}" />
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
然后您可以使用 CSS 对其进行样式设置:
ListView StackLayout Label {
font-size: 14;
color: black;
}
推荐阅读
- angular - 我试图少用,但是当我安装 angular cli 时,我在命令行中接受了它作为 CSS。现在我的错误越来越少
- bioinformatics - 来自基因登录号的 TaxID:Efetch
- c# - CosmosDB Upsert 抛出错误 具有 id 的实体在不存在时已存在
- python - 该函数需要接收一个字符串并使用字母变量和直方图函数来输出字符串中缺少的字母
- nuxt.js - Nuxt 在使用大的 html 文件内容时崩溃
- javascript - 如果响应包含 50 个 id,如何使用递归进行连续的 axios 调用?
- html - 如何使用 CSS 创建带有框阴影和动态颜色的弯曲滑块单元格?
- python - 如何在python中将字符串转换为日期时间?
- ios - 为什么点击tableViewCell中的按钮时只返回一个uid?
- javascript - Ajax 请求在成功时删除我的元素