【问题标题】:Unable to use LinearLayout in Xamarin.Forms无法在 Xamarin.Forms 中使用 LinearLayout
【发布时间】: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 xamarin xamarin.forms


【解决方案1】:

Xamarin.Forms 中没有 LinearLayout,您可能会与 Xamarin Native 混淆。

您可以在 Xamarin.Forms 中实现的布局列表。

另外,您可能正在寻找这种结构的 StackLayout

Xamarin.Forms Layouts

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-07-28
    相关资源
    最近更新 更多