I am displaying some thumbnails with Gridview. The strange problem I am having is that if android:minSdkVersion is not specified in the manifest the thumbnails are properly spaced but if I specify the minSdkVersion (needs to be 4 or more) the thumbnails merge together horizontally.
This problem is only on my test phone, a T Mobile pulse mini, I get no such problem on the emulator.
Grateful for any bright ideas on开发者_JAVA百科 this one.
The XML is shown below.
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
<!--thumbnails-->
<GridView
android:id="@+id/gridview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:columnWidth="90dp"
android:numColumns="auto_fit"
android:verticalSpacing="10dp"
android:horizontalSpacing="10dp"
android:stretchMode="none"
android:gravity="center"
/>
</LinearLayout>
The Property "auto_fit" is available after API version 4. So in the line
android:numColumns="auto_fit"
You will have to specify the number of columns. For more information refer
http://developer.android.com/reference/android/widget/GridView.html#AUTO_FIT
精彩评论