【发布时间】:2017-07-12 03:17:13
【问题描述】:
我有一个GridLayout,里面有 3 列和随机数量的孩子,我希望每个孩子填写一列,而且只有一列,不多也不少。
但是下面的代码使TextViews 填充的不止这些。我希望每个 TextView 填满 1/3 的空间。
<android.support.v7.widget.GridLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:columnCount="3">
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_columnWeight="1"
android:background="#abcdef"
app:viewAspectRatio="3"/>
<TextView
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_columnWeight="1"
android:background="#fedcba"
app:viewAspectRatio="3" />
</android.support.v7.widget.GridLayout>
如果 GridLayout 不可能,我很想知道其他可能性
【问题讨论】:
标签: android grid-layout android-gridlayout