我有一个问题,我应该知道每一行中的GridView
这被显示为不同的设备的数量。如的GridView
每行的片数,WVGA手机..since其屏幕宽度不同..是有一个code检查这个?
I have a problem where i should know the number of gridview
in each row which gets displayed for different devices. like number of gridview
per row for tablets, WVGA phones ..since their screen widths are different ..is there a code to check this?
OKK您可以用编程方式设置的列数
Okk you can set number of columns programatically using
float scalefactor = getResources().getDisplayMetrics().density * 100;
int number = getWindowManager().getDefaultDisplay().getWidth();
int columns = (int) ((float) number / (float) scalefactor);
gridView.setNumColumns(columns);
其中100是每个列对M取所有设备的固定宽度......我得到的平板电脑,3 8列三星三星笔记2.2设备和4
where 100 is the fixed width of each column for all devices m taking...i get 8 columns in tablet,3 in samsung 2.2 devices and 4 in samsung note