在'android'包中找不到属性'layout_columnWeight'的资源标识符

Abh*_* CR 1 resources android package

错误:(25)在'android'包中找不到属性'layout_columnWeight'的资源标识符....

我无法在我的xml中更新它..当我使用网格布局时出现了..

 <GridLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_centerVertical="true"
    android:layout_toRightOf="@+id/textView"
    android:layout_toEndOf="@+id/textView">

    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="New Button"
        android:id="@+id/button"
        android:layout_columnWeight="0"
        />
   </GridLayout>
Run Code Online (Sandbox Code Playgroud)

mic*_*zuk 8

如果您想使用GridLayoutcolumnWeight性能的最佳方法是使用V7支持的版本.

<android.support.v7.widget.GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_centerVertical="true"
    android:layout_toRightOf="@+id/textView"
    android:layout_toEndOf="@+id/textView">


    <Button
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text="New Button"
        android:id="@+id/button"
        app:layout_columnWeight="0"
        />
   </GridLayout>
Run Code Online (Sandbox Code Playgroud)

请记住,如果要使用此v7.widget.GridLayout,则必须导入此库添加compile 'com.android.support:gridlayout-v7:23.1.1'到gradle