I'm using a CheckBox in the row item of my ListView. Is set the CheckBox to android:focusable="false"
. So the OnItemClickListener for the ListView works correctly but the checkBox seems to be unclickable. How can i solve this?
in my custom arrayAdapter:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View v = convertView;
FileHolder holder;
if(v == null){
LayoutInflater inflater = ((Activity)getContext()).getLayoutInflater();
v = inflater.inflate(layoutResourceId, parent, false);
holder = new FileHolder();
holder.isChecked = (CheckBox)v.findViewById(R.id.checkBox1);
v.setTag(holder);
holder.isChecked.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
Log.d("common", "checked");
}
});
}
}
in row_item.xml:
<CheckBox
android:id="@+id/checkBox1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_centerVertical="true"
android:button="@drawable/checkbox"
android:focusable="false"
android:focusableInTouchMode="false"
android:clickable="true"/>
EDIT: I tried to register an OnTouchListener, but onTouch() gets also not called.