Gridview对齐靠近屏幕的左侧

时间:2014-06-05 11:54:40

标签: android android-gridview android-framelayout stretching

我在FrameLayout中有一个GridView,如下所示:

Gridview Screen

如图所示,数字更靠近屏幕的左侧。我试图让数字更接近,以便我可以解决问题,但失败了。使用stretchMode,比如' columnWidth'并且没有'无法解决我的问题。请建议我任何方式,我可以在背景白色区域内拟合数字。

.xml文件:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical" >


<FrameLayout
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" >

    <GridView
        android:id="@+id/gridview"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/paperbck"
        android:columnWidth="30dp"
        android:gravity="center"
        android:horizontalSpacing="20dp"
        android:numColumns="4"
        android:stretchMode="columnWidth"
        android:verticalSpacing="20dp" />


</FrameLayout>

</LinearLayout>

1 个答案:

答案 0 :(得分:0)

尝试向网格视图提供左边距。

相关问题