Xamarin ContentView内容宽度和高度-当ContentView大小合适时为1
我有一个简单的Xamarin ContentView内容宽度和高度-当ContentView大小合适时为1,xamarin,xamarin.forms,Xamarin,Xamarin.forms,我有一个简单的Xamarin.Forms项目,其中包含ContentView,我想将其添加到ContentPage 这是我的ContentPage ContentView确实添加到了ContentPage,因为ContentPage变为红色,但没有显示任何内容。 当我在ContentView private void View\u size更改(对象发送方,事件参数e) { Debug.WriteLine(此.Width); Debug.WriteLine(此.Height); Deb
Xamarin.Forms
项目,其中包含ContentView
,我想将其添加到ContentPage
这是我的ContentPage
ContentView
确实添加到了ContentPage
,因为ContentPage
变为红色,但没有显示任何内容。
当我在ContentView
private void View\u size更改(对象发送方,事件参数e)
{
Debug.WriteLine(此.Width);
Debug.WriteLine(此.Height);
Debug.WriteLine(this.Content.Width);
Debug.WriteLine(this.Content.Height);
}
ContentView
的宽度和高度确实设置为width:360
,height:616
,但内容的宽度和高度是-1
编辑
我只是注意到它在使用Xamarin Live Player时不起作用,但在使用模拟器时起作用…@Diegrafaelsouza没有硬输入的内容,只是在安装了ContentView的手机无法复制时检索到了这些值。任何相关信息都被遗漏了?@Diegrafaelsouza你能告诉我你的.projitems是什么样子吗?我没有
.projitems
文件。