【发布时间】:2017-12-20 12:35:53
【问题描述】:
我正在使用表格布局设计表单,但编译器抱怨许多属性要么未定义,要么不允许。这是布局的 sn-p:
<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.
【问题讨论】:
-
您的“layout_margin”错误是不允许使用整数类型,是的,它允许与密度无关的点....类似于 android:layout_marginRight="1dp"
标签: android xamarin xamarin.android