Xamarin Android Forms Designer无法识别Gridlayout布局参数



我正在使用表布局设计表单,但是编译器抱怨许多属性是不定定义或不允许的。这是布局的片段:

<GridLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:id="@+id/gridLayout1"
    android:columnCount="2"
    android:rowCount="2">
    <LinearLayout
        android:orientation="vertical"
        android:minWidth="25px"
        android:minHeight="25px"
        android:id="@+id/player1Layout"
        android:layout_column="0"
        android:layout_row="0"
        android:background="@android:color/holo_green_dark"
        android:layout_gravity="fill"
        android:layout_columnWeight="1"
        android:layout_rowWeight="1"
        android:layout_margin="1" />

编译时,我会得到与layout_*属性相关的警告和错误。目前,我设置了所有三个API级别(编译,目标和最小值)26,我敢肯定它具有所有这些属性,但是我会收到以下错误:

error APT0000: 1: error: Error: Integer types not allowed (at 'layout_margin' with value '1').
error APT0000: 1: error: Error: Integer types not allowed (at 'layout_margin' with value '1').
error APT0000: 1: error: Error: Integer types not allowed (at 'layout_margin' with value '1').
error APT0000: 1: error: Error: Integer types not allowed (at 'layout_margin' with value '1').
The 'http://schemas.android.com/apk/res/android:layout_column' attribute is not declared.
The 'http://schemas.android.com/apk/res/android:layout_row' attribute is not declared.
The 'http://schemas.android.com/apk/res/android:layout_columnWeight' attribute is not declared.
The 'http://schemas.android.com/apk/res/android:layout_rowWeight' attribute is not declared.

错误apt0000:1:错误:错误:不允许使用整数类型(在'layout_margin'with value'1')。

使用dp单位,即:

android:layout_margin="1dp"

最新更新