0

グリッドビューでアイテムを一覧表示したい。グリッド ビューはアダプターを接続しました。このアダプターには、レイアウト xml があります。xmlは次のとおりです。

    <?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="horizontal" >
    <TextView
        android:id="@+id/txtUrunAd"
        style="@style/gridline"
        android:layout_height="match_parent"
        android:layout_width="1dp"
        android:layout_weight="40"
        android:text="@string/GrdUrunAd" />
     <TextView
        android:id="@+id/txtMiktar"
        style="@style/gridline"
        android:layout_height="match_parent"
        android:layout_width="1dp"
        android:layout_weight="15"
        android:text="@string/GrdMiktar" />
    <TextView
        android:id="@+id/txtBirim"
        style="@style/gridline"
        android:layout_height="match_parent"
        android:layout_width="1dp"
        android:layout_weight="15"
        android:text="@string/GrdBirim" />
    <TextView
        android:id="@+id/txtFiyat"
        style="@style/gridline"
        android:layout_height="match_parent"
        android:layout_width="1dp"
        android:layout_weight="15"
        android:text="@string/GrdFiyat" />

    <TextView
        android:id="@+id/txtTutar"
        style="@style/gridline"
        android:layout_height="match_parent"
        android:layout_width="1dp"
        android:layout_weight="15"
        android:text="@string/GrdTutar" />
</LinearLayout>

注意が払われれば、私のレイアウトにはスタイルがあります。このスタイルを設定すると、グリッドビューがセレクター効果を失いました。このスタイルを削除すると、グリッドビューにはセレクター効果があります。

    <style name="gridline" parent="AppBaseTheme">
        <item name="android:singleLine">true</item>
        <item name="android:ellipsize">marquee</item>
        <item name="android:marqueeRepeatLimit">marquee_forever</item> 
        <item name="android:focusable">true</item>
        <item name="android:focusableInTouchMode">true</item>
        <item name="android:scrollHorizontally">true</item>
        <item name="android:background">@color/grdlinebackcolor_white</item>
    </style>
4

1 に答える 1

0

あなたの問題は、背景を単色に設定していると思います。セレクターは、アイテムの背景として設定されるドローアブルです

于 2014-06-07T08:41:17.370 に答える