.NET-3.Xamarin3.学习与总结
前言
记录学习过程中的值得记录的问题与小知识。
//ScrollView
//ScrollX和ScrollY当前滚动量还
//提供内容总量ContentSize。
//滚动结束事件Scrolled,
一、字体的更换
有两种方式。
第一种官网字体
[assembly: ExportFont("FZSTK.TTF", Alias = "FZSTK")]
[assembly: ExportFont("SIMYOU.TTF", Alias = "SIMYOU")]
[assembly: ExportFont("STXINGKA.TTF", Alias = "STXINGKA")]
[assembly: ExportFont("SIMHEI.TTF", Alias = "simhei")]
[assembly: ExportFont("Lobster-Regular.ttf", Alias = "Lobster")]
//第二种
<ContentPage.Resources>
<ResourceDictionary>
<OnPlatform x:TypeArguments="x:String" x:Key="aaa">
<On Platform="Android" Value="Lobster-Regular.ttf#"/>
<On Platform="iOS" Value="Lobster-Regular"/>
<On Platform="UWP" Value="/Assets/Lobster-Regular.ttf#" />
</OnPlatform>
</ResourceDictionary>
</ContentPage.Resources>
<Label Text="Welcome toamari 天赐良机 Forms! " FontFamily="{StaticResource aaa}" />
二、Xamarin listview更改颜色
var lastCell ;
private void ViewCell_Tapped(object sender, EventArgs e)
{
if (lastCell != null)
lastCell.View.BackgroundColor = Color.Red;//默认颜色
var viewCell = (ViewCell)sender;
if (viewCell.View != null)
{
viewCell.View.BackgroundColor = Color.Green;//点击后颜色
lastCell = viewCell;
}
}