Androidグリッドビューでは、グリッドビューの行の間に余分なスペースがあります。グリッドビューにスペースを追加していません。
これが私のxmlファイルです
<GridView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/grid"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:horizontalSpacing="5px"
android:numColumns="3"
android:columnWidth="50dip"
android:verticalSpacing="0dip"
android:gravity="center"
/>
グリッドビューにビューを追加しているimageviewの他のxmlは
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/singlePhoto"
android:layout_gravity="top"
android:layout_width="145dip"
android:layout_height="145dip"
android:layout_marginTop="0dip"
android:layout_marginBottom="0dip"
>
</ImageView>
Adapterクラスでは、コードは次のとおりです。
if(mView == null){
mView = mLayoutInflater.inflate(R.layout.newsgridthumbpic, null);
}
ImageView mImage = (ImageView)mView.findViewById(R.id.singlePhoto);
PhotoGridInfoSet mInfo = (PhotoGridInfoSet)details.get(position);
if(mImage != null){
mImage.setTag(mInfo.getPhotoThumbNailString());
mImage.setVerticalScrollBarEnabled(true);
mImage.setVerticalFadingEdgeEnabled(true);
}
}!
スペースはgridviewの行の間にあります。コードのどこにもスペースを追加していませんが、垂直方向のスペースがあります。グリッドビューの行の間にスペースがある理由がわかりません。このスペースは、hdpiデバイス/エミュレーターには表示されません。この問題は、mdpiおよびldpiデバイス/エミュレーターにあります。