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

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -