android - 无法在 Xamarin.Forms 中使用 LinearLayout
问题描述
我正在学习 Xamarin.Forms 并遵循 Android 线性布局的以下文档 - https://developer.android.com/reference/android/widget/LinearLayout
我收到了这个错误
错误 XLS0414 找不到类型“LinearLayout”。确认您没有丢失程序集引用并且所有引用的程序集都已构建。DPM MainPage.xaml
同样在“输出”窗口中,消息说
在 xmlns http://xamarin.com/schemas/2014/forms中找不到类型 LinearLayout
这是视图
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:local="clr-namespace:DPM"
x:Class="DPM.MainPage">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:orientation="horizontal"
android:gravity="center">
<!-- Place new controls here -->
<Label Text="Prueba"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand" />
<Label Text="Welcome to Xamarin.Forms!"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand" />
<Label Text="Bottom"
HorizontalOptions="Center"
VerticalOptions="CenterAndExpand" />
</LinearLayout>
</ContentPage>
如果需要更多信息来解决这个问题,请使用评论告诉我
解决方案
Xamarin.Forms 中没有 LinearLayout,您可能会与 Xamarin Native 混淆。
有一个可以在 Xamarin.Forms 中实现的布局列表。
此外,您可能正在为这种结构寻找 StackLayout
推荐阅读
- javascript - 获取 EJS 模板的渲染输出并存储在变量中
- c# - C# WPF TabControl 模板继承问题
- python - 如何在日期上使用正则表达式按年份提取条目?
- nlp - 在编码和解码中只有一个嵌入层的语言模型仅预测
- r - 为几何条形图中的标签选择排序
- git - Git 构造了一个特定的提交 shat,它在示例中看起来不错,用于教育目的
- javascript - 将 jquery 字符串插入到 php 数组中
- css - 如何编码 reCaptcha 以保护电子邮件地址
- double - 如何在 redix 指向 int 类型之前将大约 10^26 的双精度数据类型数舍入?
- apache-kafka - 将融合的 jdbc 接收器连接器与事件中心模式注册表连接