网格视图我必须显示3X3矩阵如何做到这一点。
输入值为水平值和垂直值。
例如,水平值为3,垂直值为3,则必须显示为以下格式
1 2 3
4 5 6
7 8 9例如,水平值为2,垂直值为2,则必须显示为以下格式
1 2
3 4例如,水平值为3,垂直值为2,则必须显示为以下格式
1 2 3
4 5 6发布于 2013-06-04 14:51:32
根据您的情况使用以下方法:
setNumColumns(int)这将在运行时设置列数。
for example horizontal value is 3 and vertical value 3 then i have to diaplay to below format
setNumColumns(3)
for example horizontal value is 2 and vertical value 2 then i have to diaplay to below format
setNumColumns(2)
for example horizontal value is 3 and vertical value 2 then i have to diaplay to below format
setNumColumns(2)发布于 2013-06-04 14:31:20
试试这个..。
<GridView
android:id="@+id/myGrid"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layoutAnimation="@anim/layout_grid_fade"
android:columnWidth="90dp"
android:numColumns="3"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:scrollbarStyle="outsideOverlay"
android:gravity="center"
android:scrollbars="vertical"
android:stretchMode="columnWidth"
>https://stackoverflow.com/questions/16911118
复制相似问题