错误报告最佳实践:https://github.com/xamarin/Xamarin.Forms/wiki/Submitting-Issues
ListView 中的标签在 Android 上无法正确布局。 iOS没问题。
2. the CheckBox code like that:
public CheckBox() {
this.TapCmd = new Command(() => {
this.Checked = !this.Checked;
if (this.CheckChanged != null)
this.CheckChanged.Invoke(this, new EventArgs());
if (this.CheckChangedCmd != null && this.CheckChangedCmd.CanExecute(this.Checked))
this.CheckChangedCmd.Execute(this.Checked);
});
StackLayout stackLayout = new StackLayout {
Orientation = StackOrientation.Horizontal
};
TapBinder.SetCmd(stackLayout, this.TapCmd);
this.Content = stackLayout;
this.Label = new Label() {
BackgroundColor = Color.Red,
BindingContext = this,
VerticalTextAlignment = TextAlignment.Center,
HorizontalOptions = LayoutOptions.StartAndExpand
};
this.Label.SetBinding(Label.TextProperty, "Text");
this.Label.SetBinding(Label.IsVisibleProperty, "ShowLabel");
this.Icon = new Image() {
WidthRequest = this.Size,
HeightRequest = this.Size,
Source = this.OffImg
};
stackLayout.Children.Add(this.Icon);
stackLayout.Children.Add(this.Label);
}
```
标签文字可以正常显示。
向上或向下滚动 ListView 时看不到某些标签的文本。
=== 适用于 Mac 的 Visual Studio 社区 2017 ===
版本 7.7.4(构建 1)
安装 UUID:4e60959a-758f-48ce-ae6d-26e15276ea83
GTK+ 2.24.23(罗利主题)
Xamarin.Mac 4.4.1.178(主/eeaeb7e6)
Package version: 516000221
=== Mono 框架 MDK ===
运行:
单声道 5.16.0.221 (2018-06/b63e5378e38)(64 位)
套餐版本:516000221
=== NuGet ===
版本:4.8.0.5385
=== .NET 核心 ===
运行时:/usr/local/share/dotnet/dotnet
运行时版本:
2.1.8
2.1.7
2.1.2
2.1.1
2.0.5
2.0.0
1.1.1
1.0.4
SDK:/usr/local/share/dotnet/sdk/2.1.504/Sdks
SDK版本:
2.1.504
2.1.503
2.1.302
2.1.301
2.1.4
2.0.0
1.0.3
MSBuild SDK:/Library/Frameworks/Mono.framework/Versions/5.16.0/lib/mono/msbuild/15.0/bin/Sdks
=== Xamarin.Mac ===
版本:5.2.1.15(Visual Studio 社区)
哈希:d60abd198
分支:
构建日期:2019-02-01 12:23:30-0500
=== Xamarin.Android ===
版本:9.1.8.0(Visual Studio 社区)
Android SDK:/Users/huangboru/myfile/sdk
支持的安卓版本:
4.2(API 级别 17)
4.4(API 级别 19)
5.1(API 级别 22)
6.0(API 级别 23)
7.0(API 级别 24)
7.1(API 级别 25)
8.0(API 级别 26)
8.1(API 级别 27)
SDK 工具版本:26.1.1
SDK平台工具版本:28.0.0
SDK 构建工具版本:28.0.3
=== 微软移动 OpenJDK ===
Java SDK:/Users/huangboru/Library/Developer/Xamarin/jdk/microsoft_dist_openjdk_1.8.0.9
openjdk 版本“1.8.0-9”
OpenJDK 运行时环境(构建 1.8.0-9-microsoft-b00)
OpenJDK 64 位服务器 VM(构建 25.71-b00,混合模式)
Android Designer EPL 代码可在此处获得:
https://github.com/xamarin/AndroidDesigner.EPL
=== 构建信息 ===
版本号:707040001
Git 修订版:2a4679454f31c8bb887cfd181ea133c9149d3cad
构建日期:2019-01-30 16:18:21+00
构建分支:release-7.7.4
Xamarin 扩展:c8b4305fd4c60b9c25947072eb150fdc3a5aa2b5
我设置了 Label 的 backgroundColor,似乎问题是由于 Label 的布局错误。
@suihanhbr你能附上一个显示这个问题的示例项目吗? 谢谢!
我将 Xamarin.Forms 的版本更新为 3.5.169047,问题消失了。
最有用的评论
我将 Xamarin.Forms 的版本更新为 3.5.169047,问题消失了。