android - onItemClickListener and view not clickable -
<?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_height="wrap_content" android:orientation="horizontal" android:layout_width="fill_parent" android:clickable="false" android:focusable="false"> <linearlayout android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginleft="10dp" android:layout_margintop="5dp" android:clickable="false" android:focusable="false" android:orientation="vertical" > <textview android:id="@+id/mxname" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:clickable="false" android:focusable="false" android:gravity="left" android:text="slashdot" android:textstyle="bold" /> <textview android:id="@+id/mxtnumber" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:clickable="false" android:focusable="false" android:gravity="left" android:text="10 minutes ago" /> </linearlayout> <linearlayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:clickable="false" android:focusable="false" android:orientation="vertical" android:gravity="right" android:descendantfocusability="blocksdescendants"> <imageview android:id="@+id/mxdialer" android:layout_width="35dp" android:layout_height="fill_parent" android:layout_weight="2" android:clickable="true" android:focusable="true" android:gravity="right" android:src="@drawable/lcall_button" /> </linearlayout> </linearlayout>
i have listview row xml listed above , below code activity:
@override public void onitemclick(adapterview<?> parent, view view, int position , long id) { log.d("itemclick","in list"+ string.valueof(view.getid())); if (view==findviewbyid(r.id.mxdialer)) { toast.maketext(this, "name and/or phone number empty"+string.valueof(id), toast.length_long).show(); } }
the logcat indicate onitemclick being execuated toast never works , view.getid() returns -1. have read articles on onitemclicklisterner , have made views not focusable , not clickable still no go. please suggest
view
root layout of clicked list item not child in item layout. toast never show.
if want click on specific child view, set onclicklistener
child, onitemclicklistener
not called. either of 2 called. child views clikclistener takes priority.
Comments
Post a Comment