网格视图我必须显示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

最佳答案

根据您的情况使用以下内容:

         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)

关于java - 网格 View 我必须显示3X3矩阵该怎么做,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/16911118/

10-09 01:29