views:

44

answers:

0

My problem is that I do not get the default/selected/pressed glowing background, so my gridview looks like images and text that give no indication that they can be pressed or interacted with. I have looked at the various API samples, and can see nothing different from the code they use and mine other than I host a LinearLayout instead of an ImageView. Is this the only issue? If it is, how can I workaround it and still use the current theme's default colors, so that the app won't look odd on a device with non-stock android?

Curiously, I can still select the items with the directional pad, and I get the default highlight color as the background exactly the way I want it, it just won't work by touching the items themselves.

Any help would be greatly appreciated, as I've spent the better part of a day trying different solutions for this.

I have a custom GridView:

<GridView
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_marginLeft="15dp"
    android:layout_marginTop="30dp"
    android:layout_marginRight="15dp"
    android:layout_marginBottom="30dp"
    android:columnWidth="100dp"
    android:numColumns="auto_fit"
    android:verticalSpacing="20dp"
    android:horizontalSpacing="30dp"
    android:stretchMode="columnWidth"
    android:gravity="center" />

Hosted in another layout. This GridView is filled with LinearLayouts:

<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:gravity="center"
    android:layout_gravity="center"
    android:clickable="true"
    android:layout_marginTop="30dp"
    android:layout_marginBottom="30dp"
    android:layout_marginLeft="70dp"
    android:layout_marginRight="70dp">
    <ImageView
        android:paddingTop="6dp"
        android:paddingLeft="6dp"
        android:paddingRight="6dp"
        android:gravity="center"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"/>
    <TextView
        android:padding="6dp"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:textColor="@android:color/primary_text_dark"
        style="@android:style/TextAppearance.Small"/>
</LinearLayout>