android - GridView 图像在 Android 中未正确调整大小

标签 android android-gridview

我在 Android 应用程序中工作,在此我需要使用 GridView 设计一个屏幕。 在我的情况下, GridView 图像未正确对齐。我在 fragment 内显示 GridView 。

我想以 3 列 * 5 行的格式排列图像。(没有滚动)

而我使用的是512 * 512像素的png格式图片

最佳答案

您可以像这样定义行和列。

    android:columnCount="5"
    android:rowCount="3"

或者您可以像这样以编程方式执行此操作

 gridview.setNumColumns(nmrOfColums);
 gridview.setNumRows(nmrOfRows);

关于android - GridView 图像在 Android 中未正确调整大小,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49880031/

相关文章:

android - ByteBuffer 不释放内存

android - GridView 只显示两列

Android 网格形成

java - 在用户完成对 SearchView 的查询后隐藏键盘

android - 将谷歌分析添加到 Android 应用程序

android - 带参数的 Volley GET

android - 显示图像网格的最有效方式

android - ScrollView 内的可扩展高度 GridView

android - GridView 在填充上产生奇怪的白边

java - 无法执行 Activity 的方法。为什么会出错?