Android中的Complexe表格/网格布局
我正在尝试做一个看起来像这样的视图Android中的Complexe表格/网格布局,android,Android,我正在尝试做一个看起来像这样的视图 其中每个UI都是文本视图或按钮。我已经工作了5个小时,但没有得到适当的结果。我尝试了TableLayout和gridLayout。如果您使用的是v7支持库中的GridLayout,我就不知道了。 compile 'com.android.support:gridlayout-v7:22.2.1' 参考此代码 <?xml version="1.0" encoding="utf-8"?> <android.support.v7.widget.
其中每个UI都是文本视图或按钮。我已经工作了5个小时,但没有得到适当的结果。我尝试了TableLayout和gridLayout。如果您使用的是v7支持库中的GridLayout,我就不知道了。
compile 'com.android.support:gridlayout-v7:22.2.1'
参考此代码
<?xml version="1.0" encoding="utf-8"?>
<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_column="4"
android:layout_row="5"
android:layout_height="match_parent">
<Button android:layout_width="0dp"
app:layout_column="0"
app:layout_columnWeight="1"
app:layout_row="0"
android:layout_height="wrap_content"/>
<Button android:layout_width="0dp"
app:layout_column="1"
app:layout_columnWeight="1"
app:layout_row="0"
android:layout_height="wrap_content"/>
<Button android:layout_width="0dp"
app:layout_column="2"
app:layout_columnWeight="1"
app:layout_row="0"
android:layout_height="wrap_content"/>
<Button android:layout_width="0dp"
app:layout_column="3"
app:layout_row="0"
app:layout_columnWeight="1"
android:layout_height="wrap_content"/>
<!-- 2nd -->
<Button android:layout_width="0dp"
app:layout_column="0"
app:layout_columnSpan="4"
app:layout_row="1"
app:layout_columnWeight="1"
android:layout_height="wrap_content"/>
<!-- 2nd -->
<Button android:layout_width="0dp"
app:layout_column="0"
app:layout_row="2"
app:layout_columnWeight="1"
android:layout_height="wrap_content"/>
<Button android:layout_width="0dp"
app:layout_column="1"
app:layout_row="2"
app:layout_columnWeight="1"
android:layout_height="wrap_content"/>
<Button android:layout_width="0dp"
app:layout_column="2"
app:layout_row="2"
app:layout_columnSpan="2"
app:layout_columnWeight="2"
android:layout_height="wrap_content"/>
<!-- 3rd -->
<Button android:layout_width="0dp"
app:layout_column="0"
app:layout_row="3"
app:layout_columnSpan="2"
app:layout_columnWeight="1"
android:layout_height="wrap_content"/>
<Button android:layout_width="0dp"
app:layout_column="2"
app:layout_row="3"
app:layout_columnSpan="2"
app:layout_rowSpan="3"
app:layout_columnWeight="1"
android:layout_height="wrap_content"/>
<!-- 3rd -->
<Button android:layout_width="0dp"
app:layout_column="0"
app:layout_row="4"
app:layout_columnWeight="1"
android:layout_height="wrap_content"/>
<Button android:layout_width="0dp"
app:layout_column="1"
app:layout_row="4"
app:layout_columnWeight="1"
android:layout_height="wrap_content"/>
<!-- 3rd -->
<Button android:layout_width="0dp"
app:layout_column="0"
app:layout_row="5"
app:layout_columnSpan="2"
app:layout_columnWeight="1"
android:layout_height="wrap_content"/>
</android.support.v7.widget.GridLayout>
图像url不正常,对我来说似乎正常。。现在呢?不,还是没有503@JCDecary你可以用GridLayout@Krish我试过了,但即使我把layout\u列放在第一个视图中,它也占据了你所缺少的所有宽度。app:layout\u rowWeight=“3”。但是我忘了用V7了谢谢