I want to list my items in gridview. The grid view connected an adapter. This adapter have a layout xml. then xml is :
<?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>
If care is taken my layout have a style. when I set this style my gridview lost selector effect. when I delete this style my gridview have selector effect.
<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>
I think your issue is setting the background as a solid colour. Selectors are drawables which are set as the items background