您应该使用维度来克服这个问题。只需为每个密度屏幕定义尺寸。
- 价值观-ldpi
- 价值观-mdpi
- 价值观-hdpi
- 价值观-xhdpi
- 值-大
值-ldpi/dimesion.xml
<resources>
<dimen name="grid_vertical_space">15dp</dimen>
</resources>
值-mdpi/dimesion.xml
<resources>
<dimen name="grid_vertical_space">20dp</dimen>
</resources>
值-hdpi/dimesion.xml
<resources>
<dimen name="grid_vertical_space">30dp</dimen>
</resources>
同样地..
像这样试试
<?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="columnWidth"
android:verticalSpacing="@dimen/grid_vertical_space" />
</LinearLayout>