1

I have an AppWidget with a ListView. To populate the ListView I'm using RemoteViewsFactory. In its getViewAt(int position) method which returns a RemoteViews object I fill my row with information.

How can I disable clicking on a ListView item? RemoteViews has no setEnabled() method that I would use for a 'normal' ListView.

kaolick
  • 4,817
  • 5
  • 42
  • 53

2 Answers2

0

Override adapter with:

@Override
public boolean areAllItemsEnabled() {
    return false;
}

@Override
public boolean isEnabled(int position) {
    return false;
}
T-Chen
  • 173
  • 6
0

Put a drawable shape as background using android:background="@drawable/list_background" in list_item.xml, when clicked it will not flash.

list_background.xml in res/drawable

<?xml version="1.0" encoding="utf-8"?>

<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <corners
      android:topLeftRadius="3dp"
      android:topRightRadius="3dp"/>
    <solid android:color="#ffff0000"/>
    <stroke
            android:color="#ffff0000"
            android:width="1dp"/>
</shape>
SchwarzeHuhn
  • 638
  • 5
  • 17