附见截图在这里,我试图降低我的GridView中列之间的空间。
See attached screenshot where I am attempting to reduce the space between the columns in my GridView.
我的main.xml如下:
My main.xml is as follows:
<?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="schemas.android/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" > <GridView android:id="@+id/gridview" android:layout_width="wrap_content" android:layout_height="wrap_content" android:stretchMode="columnWidth" android:gravity="center" /> <LinearLayout android:orientation="horizontal" android:layout_width="fill_parent" android:layout_height="fill_parent"> <ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:src="@drawable/logo"/> <TextView android:text="@string/game_score" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_gravity="center"/> </LinearLayout> </LinearLayout>我在创建从位图我的code中的ImageViews。不过,我不指定任何填充或间隔或以其他方式。
I am creating the ImageViews in my code from a Bitmap. However, I am not specifying any padding or spacing or otherwise.
我怎样才能减少列之间的空间?我试过了各种关于两个GridView和ImageViews但没有运气
How can I reduce this space between columns? I've tried a variety of settings on both GridViews and ImageViews but with no luck
图片
Image is :
感谢
推荐答案尝试修复电网XML文件所需的列数,并设置stretchMode为columnWidth时
try to fix the number of columns needed in xml file for grid and set stretchMode as columnwidth
android:numColumns="3" android:columnWidth="60dp" android:stretchMode="columnWidth"或设置水平和垂直间距以xml电网
or set the horizontal and vertical spacing in xml for grid
android:verticalSpacing="10dp" android:horizontalSpacing="10dp"更多推荐
安卓:在GridView控件减少列之间的空间
发布评论