Reputation: 29121
I am using cwac-endless adapter , and i am facing problems in disabling the click on the pending view while i try to load more results.
This is the constructor i am using for my custom adapter which extends EndlessAdapter. R.layout.pending which gets inflated while loading. I want to disable click on this list Item.
public class MyEndlessAdapter extends EndlessAdapter{
public MyEndlessAdapter(Context context, ListAdapter wrapped, int pendingResource) {
super(context, wrapped, R.layout.pending);
}
}
R.layout.pending xml is ...
<?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/text1"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textColor="@color/white"
android:textStyle="bold"
android:gravity="center_vertical"
android:paddingLeft="6dip"
android:minHeight="?android:attr/listPreferredItemHeight"
android:text="Getting more results..."
/>
What i tried was to give android:clickable="false" for the TextView, but it din't work.
So, i would like to know if there are any work arounds for this problem.
Upvotes: 2
Views: 577
Reputation: 4084
My ListView
is lv
lv.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
EndlessWordAdapter a = (EndlessWordAdapter)
parent.getAdapter();
if(!(a.getItemViewType(position) ==
Adapter.IGNORE_ITEM_VIEW_TYPE)) {
// Do something
} else {
// Ignore, pending view was clicked
}
}
});
Disabling long press works the same way.
Upvotes: 3