代码之家  ›  专栏  ›  技术社区  ›  Mauricio Gracia Gutierrez

无法在Xamarin.Forms中使用LinearLayout

  •  0
  • Mauricio Gracia Gutierrez  · 技术社区  · 7 年前

    https://developer.android.com/reference/android/widget/LinearLayout

    我收到了这个错误

    错误XLS0414未找到类型“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>
    

    如果需要更多的信息来解决这个问题,请使用评论让我知道

    1 回复  |  直到 7 年前
        1
  •  2
  •   Joaquín    7 年前

    有一个可以在Xamarin.Forms中实现的布局列表。

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

    Xamarin.Forms Layouts