My objective is to check a checkbox by clicking an item in listview. But items are no longer clickable after I put check boxes. I have tried everything from:
android:descendantFocusability="blocksDescendants"
android:focusable="false"
android:focusableInTouchMode="false"
android:clickable="true"
android:longClickable="true"
These are the things that I found through searching.
XML(for listview):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:id="@+id/x"
android:weightSum="1">
<ListView
android:layout_width="fill_parent"
android:layout_height="0dip"
android:layout_weight="1"
android:clickable="true"
android:longClickable="true"
android:id="@+id/list">
</ListView>
</LinearLayout>
XML (for layout inside the listview):
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://ift.tt/nIICcg"
xmlns:tools="http://ift.tt/LrGmb4"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
android:layout_gravity="right"
android:id="@+id/mylayout"
android:weightSum="1"
android:descendantFocusability="blocksDescendants">
<CheckBox
android:id="@+id/checkbox"
android:focusable="false"
android:focusableInTouchMode="false"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:onClick="onCheckboxClicked" >
</CheckBox>
<TextView
android:id ="@+id/textView"
android:textSize="30dp"
android:layout_marginRight="30dp"
android:layout_height="wrap_content"
android:layout_width="wrap_content"></TextView>
</LinearLayout>
No comments:
Post a Comment