I have trying to solve this problem from last few days but no success. I have gone through lot of solution that are already available but non is working for me. I have customer list view and custom row. I am using simple cursor adaptor to populate the list view. In my custom row I have three images view and one text view. one of the view is click able that open the popup window and row navigate to next fragment. My problem is that click able image does not respond until I select the whole row. When I select row it become click able.
row
<ImageView
android:id="@+id/iv_LvRow_speedmap_PIcon"
android:layout_width="0dip"
android:layout_height="50dip"
android:layout_weight="0.20"
android:contentDescription="@string/todo"
android:paddingLeft="10dip"
android:src="@drawable/arrow4" />
<TextView
android:id="@+id/tv_LVRow_SpeedMap_PDesc"
android:layout_width="0dip"
android:layout_height="50dip"
android:layout_weight="0.60"
android:ellipsize="none"
android:gravity="center_vertical|center_horizontal"
android:scrollHorizontally="true"
android:singleLine="true"
android:text="@string/textview"
android:textColor="@color/black"
android:textSize="14sp" />
<ImageView
android:id="@+id/ib_LvRow_SpeedMap_InfoIcon"
android:layout_width="0dip"
android:layout_height="50dip"
android:layout_weight="0.10"
android:clickable="true"
android:contentDescription="@string/todo"
android:duplicateParentState="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:src="@drawable/info_icon" />
<ImageView
android:id="@+id/imgView_ArrowImg_speedMap"
android:layout_width="0dip"
android:layout_height="50dip"
android:layout_weight="0.10"
android:contentDescription="@string/todo"
android:src="@drawable/arrow4" />
</LinearLayout>
ListView lv = getListView();
// lv.setItemsCanFocus(true);
// lv.setClickable(true);
// lv.setFocusable(true);
lv.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View v, int arg2,
long arg3) {
final String where = "id = " + Long.toString(arg3);
ImageView iv = (ImageView) v
.findViewById(R.id.ib_LvRow_SpeedMap_InfoIcon);
// iv.setClickable(true);
// iv.setFocusable(true);
iv.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
System.out.println("id2");
String[] projection = { "name", "description" };
String selection = where;
Cursor cursor = null;
cursor = getActivity().getContentResolver().query(
DatabaseContentProvider.CONTENT_URI_CONCERNS,
projection, selection, null, null);
cursor.moveToFirst();
if (cursor.getCount() > 0) {
String name = cursor.getString(cursor
.getColumnIndex("name"));
System.out.println("name" + name);
String description = cursor.getString(cursor
.getColumnIndex("description"));
System.out.println("description" + description);
info(name, description, v);
}
}
});
}
});
Finally solved my problem after long struggle. following link helped me a lot.
Multi clickable zone in listview.
http://wiresareobsolete.com/wordpress/tag/clickable/