2016-06-19 7 views
0

この画像のようにする必要があります。グリッドビューを試しましたが、動作しません。同じ行に3つ以上の画像が表示されます。 imageカスタムグリッドビューデザインを作成

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
android:orientation="vertical" > 

<ImageView 
    android:id="@+id/imageView1" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    android:scaleType="centerCrop"/> 

<TextView 
    android:id="@+id/textView1" 
    android:layout_gravity="center" 
    android:layout_width="wrap_content" 
    android:layout_height="wrap_content" 
    android:textSize="15dp" 
    android:layout_marginTop="5dp" 
    android:layout_marginBottom="5dp" 
    android:text="TextView" /> 

、これが私のGridViewのです:

<GridView 
    android:id="@+id/gridview" 

    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:numColumns="3" > </GridView> 

答えて

0

あなたは、私はいくつかのコードを追加numColumnsの= 3

<GridView 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:numColumns="3"/> 
+0

てみました、私もこのGridViewのを持っていました。 –

+0

xmlコードの最初のセットがグリッドアイテムレイアウトであると仮定します。もしそうなら、あなたのtextviewは、imageviewのmatch_parentの高さによって押し出されるので決して見えません。あなたの質問に対する答えではなく、ここで問題を指摘してください。 – Tony

+0

なので、私にいくつかのアイディアを教えてもらえますか?すべての線形レイアウトで3線形レイアウトを使用する必要があります。これを解決するために3つのイメージビューを配置し、グリッドビューを使用せずに、どう思いますか? –

関連する問題