0

CheckedTextView を項目として GridView を作成しました。

ここで、XML の私の Gridview

<GridView
    android:id="@+id/grid_1"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"                
    android:numColumns="auto_fit"
    android:horizontalSpacing="5dip"
    android:verticalSpacing="5dip"                
    android:gravity="center"                       
    android:choiceMode="multipleChoice"/>

ここでは XML の GridView アイテム

<?xml version="1.0" encoding="utf-8"?>
<CheckedTextView xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/checkedTextView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"        
    android:textColor="@color/gray_color"    
    android:background="@drawable/shape_rectangle"/>

ただし、2つのアイテムを連続して表示し、各アイテムは以下のように余分なスペースで表示されます ここに画像の説明を入力

GridView の各項目の余分なスペースを避ける方法は?

4

1 に答える 1

0

アイテムの幅と高さで match_parent を使用してみてください。何が問題なのかわかりませんが、これにも遭遇しました。これで修正されたかどうか教えてください。それ以外の場合は、古いプロジェクトを調べて、別の解決策を見つけてください

于 2013-10-30T09:35:15.793 に答える