【发布时间】:2019-03-31 11:54:03
【问题描述】:
我正在学习 Xamarin.Forms 并遵循以下 Android 线性布局文档 - https://developer.android.com/reference/android/widget/LinearLayout
我收到了这个错误
错误 XLS0414 找不到类型“LinearLayout”。确认您 没有缺少程序集引用并且所有引用 组件已建成。 DPM MainPage.xaml
消息也在输出窗口中显示
在 xmlns 中找不到类型 LinearLayout http://xamarin.com/schemas/2014/forms
这里是视图
<?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>
如果需要更多信息来解决此问题,请使用 cmets 告诉我
【问题讨论】:
-
您可以混合使用基于 Android AXML 的布局与基于 Xamarin.Forms XAML 的布局。如果这是基于 Xamarin.Forms 的应用程序,您只需要坚持使用 Forms 的 XAML:docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/…
标签: android xamarin xamarin.forms