0
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="horizontal"
    android:background="#FFFFFF"
    android:layout_gravity="center"
    android:padding="5dip" >
    <GridView
        android:id="@+id/homeGridView"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:columnWidth="200dip"
        android:adjustViewBounds="true" 
        android:layout_gravity="center"
        android:gravity="center"
        android:horizontalSpacing="0dip"
        android:numColumns="2"
        android:stretchMode="none"
        android:verticalSpacing="@dimen/grid_vertical_space" />
</LinearLayout>

デバイスの GridView センターを作成する方法は?

4

2 に答える 2

1

Linear Layout の代わりにRelative Layoutを使用し、Gird View にandroid:layout_centerInParent="true"を適用します

于 2013-03-22T11:02:48.447 に答える
0

Gridviewandroid:layout_widthandroid:layout_heightwrap_content を設定しようとしましたか?

于 2013-03-22T11:00:28.723 に答える