Android 网格布局工作不正常
我使用的是android studio 2.3.2,我的问题是,当我将gridlayout添加到我的应用程序中时,我无法更改列数和行数。还有一条消息说,此网格布局没有用,我也无法将任何图像添加到gridlayout的图像视图中。我已经尝试使用使用xml在“设计”视图和“文本”视图中显示属性,但它不起作用,当我将imageview拖到gridlayout上时,也看不到任何网格线。使用支持库中的android.support.v7.widget.gridlayout来管理android中的网格布局 下面是一个小预览Android 网格布局工作不正常,android,Android,我使用的是android studio 2.3.2,我的问题是,当我将gridlayout添加到我的应用程序中时,我无法更改列数和行数。还有一条消息说,此网格布局没有用,我也无法将任何图像添加到gridlayout的图像视图中。我已经尝试使用使用xml在“设计”视图和“文本”视图中显示属性,但它不起作用,当我将imageview拖到gridlayout上时,也看不到任何网格线。使用支持库中的android.support.v7.widget.gridlayout来管理android中的网格布局
<android.support.v7.widget.GridLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:tools="http://schemas.android.com/tools"
tools:background="@drawable/bg_paper"
app:rowCount="4"
app:columnCount="3"
app:orientation="vertical"
android:layout_marginBottom="50dp">
<android.support.v7.widget.AppCompatImageView
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_columnSpan="2"
app:layout_row="0"
app:layout_column="0"
app:layout_rowWeight="5"
app:layout_columnWeight="1"
app:layout_gravity="fill"
android:scaleType="fitCenter"
app:srcCompat="@drawable/img_onboarding_search" />
<TextView
app:layout_row="1"
app:layout_column="0"
app:layout_rowWeight="1"
app:layout_columnWeight="1"
app:layout_gravity="fill"
android:text="@string/onboarding_title_step_1"/>
<TextView
app:layout_row="2"
app:layout_column="0"
app:layout_rowWeight="5"
app:layout_columnWeight="1"
app:layout_gravity="fill"
android:text="@string/onboarding_message_step_1"/></android.support.v7.widget.GridLayout>
请查看以下内容: