App Widget: Ripple effect lost on list item when background is added to outer layout

Viewed 597

This thing is driving me crazy. Here's how it works

1. everything is set as default

  • ripple effect works
  • list view item separator is visible

original state

2. white background added to the widget layout

  • ripple lost
  • list view item separator also gone
  • looks like list item style has been removed

white background

Here's the code

main widget layout

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              ...
              android:background="@android:color/white" -- this line only applies for case 2
              android:padding="@dimen/widget_padding">

    <TextView
        ...
        android:background="@color/primary"
        android:textColor="@android:color/white"/>

    <ListView
        ...
        android:drawSelectorOnTop="true""/>

    <TextView
        ...
        android:textColor="?android:attr/textColorSecondary"/>

</LinearLayout>

list item layout

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    ...
    android:id="@+id/widgetItem">

    <TextView
        ...
        android:textColor="@android:color/black"
        android:textSize="14sp"/>

    <TextView
        ...
        android:textColor="@color/negative_amount"
        android:textSize="16sp"
        android:textStyle="bold"/>

</RelativeLayout>

I've spent a day trying all possible combinations but nothing helped. And I don't get the fact that unrelated background change to some layout around the list view completely alters the behaviour. WTF?

I would like to solve it in the cleanest way possible - e.i. no hacking with custom selectors. This should work straight out of the box if possible.

1 Answers
Related