I want to use ripple effect for this I set to android:clickable="true"
but when I do this onClick
event is not working,but onLongClick
is working.How can I resolve this ?
If I don't set android:clickable
it is working.
My layout:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:paddingBottom="4dp"
android:paddingTop="4dp"
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:longClickable="true"
android:background="@drawable/ripple">
Code:
listView.setOnItemClickListener(new OnItemClickListener() {
public void onItemClick(AdapterView<?> parent, View view,
int position, long id) {
Log.w("Item Clicked","Ok");
}
});
listView.setOnItemLongClickListener(new OnItemLongClickListener() {
public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
int pos, long id) {
Log.w("Item Long Clicked","Ok");
}
});