问题描述
以下是我的xml code:
Following is my xml code:
<?xml version="1.0" encoding="utf-8"?>
<GridView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/gridviewgallery"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:columnWidth="@dimen/gridview_column_width"
android:numColumns="auto_fit"
android:verticalSpacing="0dp"
android:horizontalSpacing="0dp"
android:stretchMode="columnWidth"
android:gravity="center"
android:background="#444444"
/>
当我使用的Android版本:stretchMode =columnWidth中,它会创建列之间的间隙(尽管它填满整个屏幕宽度)如果我用安卓stretchMode =无,它被左对齐并没有留在屏幕右侧的(虽然现在还列之间没有缝隙)缝隙问题是,我想这两个:要充满整个屏幕宽度以及列之间没有间隙。如何实现的呢?
When I use android:stretchMode="columnWidth" , it creates a gap between the columns(though it fills the screen width)And if I use android:stretchMode="none" , it gets left aligned and there is a gap left on right side of screen(though now there is no gap between columns)Problem is I want both : To fill the screen width as well no gap between columns.How to achieve it?
推荐答案
这是非常简单的家伙,只是删除行
It's very simple dude, just remove the line
android:columnWidth="@dimen/gridview_column_width"
您可以指定任意数量的列,我是给定列数= 4
you can specify any number of columns, i am given number of column = 4
android:numColumns = "4"
这是工作的罚款,我
这篇关于其中stretchMode在GridView的Android上使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!