I have a list view whose element is as below containing one checkbox
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
android:layout_width="match_parent"
android:background="@color/white"
android:orientation="vertical"
android:layout_height="wrap_content">
<RelativeLayout
android:layout_width="match_parent"
android:minHeight="64dp"
android:layout_marginRight="8dp"
android:layout_marginLeft="8dp"
android:layout_height="wrap_content">
<ImageView
android:id="@+id/imageViewVoucherIcon"
android:layout_width="50dp"
android:layout_centerVertical="true"
android:layout_height="50dp"
android:layout_alignParentLeft="true"
android:src="@drawable/ic_launcher" />
<TextView
android:id="@+id/textViewVoucherText"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textSize="16sp"
android:layout_toLeftOf="@+id/checkboxVoucherClick"
android:layout_centerVertical="true"
android:layout_marginLeft="8dp"
android:textColor="@color/text"
android:text="sas"
android:layout_toRightOf="@+id/imageViewVoucherIcon" />
<CheckBox
android:id="@+id/checkboxVoucherClick"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="8dp"
android:layout_alignParentRight="true"
android:layout_centerVertical="true" />
</RelativeLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="@color/seperator" />
</LinearLayout>
This is my onitem click listener
lvVoucher.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
CheckBox cb=(CheckBox)view.findViewById(R.id.checkboxVoucherClick);
if(cb.isChecked())
{
Log.e("check","true");
}else{
Log.e("check","false");
}
}
});
But it does not returns anything.
Aucun commentaire:
Enregistrer un commentaire