Android – number of grids for different devices
•
Android
I have a question. I should know the number of GridViews per line for different devices. Like tablets and WVGA phones, the number of GridViews per line.. because their screen widths are different.. is there a code to check this?
resolvent:
Okk you can set the number of columns programmatically
float scalefactor = getResources().getDisplayMetrics().density * 100; int width = getWindowManager().getDefaultDisplay().getWidth(); int columns = (int) ((float)width / (float) scalefactor); gridView.setNumColumns(columns);
@H_301_11@其中100是所有设备的每列的固定宽度…我在平板电脑中获得8列,在三星2.2设备中获得3列,在三星中获得4个音符
总结
以上是编程之家为你收集整理的android – 不同设备的网格数全部内容,希望文章能够帮你解决android – 不同设备的网格数所遇到的程序开发问题。
如果觉得编程之家网站内容还不错,欢迎将编程之家网站推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码