Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/232.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android Gridview更靠近屏幕左侧对齐_Android_Android Gridview_Android Framelayout_Stretching - Fatal编程技术网

Android Gridview更靠近屏幕左侧对齐

Android Gridview更靠近屏幕左侧对齐,android,android-gridview,android-framelayout,stretching,Android,Android Gridview,Android Framelayout,Stretching,我在FrameLayout中有一个GridView,如下所示: 如图所示,数字排列得更靠近屏幕的左侧。我曾试图让数字更接近,以便解决问题,但失败了。使用诸如“columnWidth”和“none”之类的stretchMode无法解决我的问题。请建议我任何方法,我可以适合在背景白色区域的数字 .xml文件: <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_widt

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

如图所示,数字排列得更靠近屏幕的左侧。我曾试图让数字更接近,以便解决问题,但失败了。使用诸如“columnWidth”和“none”之类的stretchMode无法解决我的问题。请建议我任何方法,我可以适合在背景白色区域的数字

.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>


尝试为网格视图留出左边距。

这不起作用。但刚才我搜索发现:android:paddingLeft=“20dp”解决了我的问题,但我不确定这是一种明智的方式。Thx thoughYes…填充是一种更好的方法…毫无疑问,继续使用它。我正要向您评论以任何方式使用paddingleft…:)