[英]No resource identifier found for attribute 'layout_columnWeight' in package 'android'
Error:(25) No resource identifier found for attribute 'layout_columnWeight' in package 'android'....错误:(25)在包“android”中找不到属性“layout_columnWeight”的资源标识符....
i am not able to update it in my xml ..it arose when i was working with grid layout ..我无法在我的 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>
If you want to use GridLayout
with columnWeight
property the best way is to use v7 support version.如果您想将
GridLayout
与columnWeight
属性一起使用,最好的方法是使用 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>
Remember that if you want to use this v7.widget.GridLayout you must import this library adding compile 'com.android.support:gridlayout-v7:23.1.1'
to gradle请记住,如果你想使用这个 v7.widget.GridLayout 你必须导入这个库,将
compile 'com.android.support:gridlayout-v7:23.1.1'
添加到 gradle
weight
is not supported by GridLayout until API 21. If you want it to be supported, you might want to use GridLayout from support library v7.在 API 21 之前,GridLayout 不支持
weight
。如果您希望支持它,您可能需要使用支持库 v7 中的 GridLayout。 Or switch to GridView.或者切换到 GridView。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.