0

I have a custom xml file for my listview and then I use an ArrayAdapter and overwrite the getView() function to set the values for the textviews in my listview.

<?xml version="1.0" encoding="utf-8"?>
<TableLayout android:id="@+id/tableLayout1" xmlns:android="http://schemas.android.com/apk/res/android">    
    <TableRow android:id="@+id/tableRow1">
        <TextView android:id="@+id/Name"></TextView>
    </TableRow>
    <TableRow android:id="@+id/tableRow2">
        <TextView android:id="@+id/Hrs"></TextView>
    </TableRow>
    <TableRow android:id="@+id/tableRow3">
        <TextView android:id="@+id/Value"></TextView>
    </TableRow>
</TableLayout>

Everything works fine right now, I can select an item in the listview to go inside it and I can long tap an item to get the context menu too.

The problem is if I try to add a checkbox to the above table (I also tried to change the table to a linear layout) then I can no longer select an item from the listview and I can no longer double tap on an item, although I can click on the checkbox. I want to be able to click on the checkbox which should fire an event and also have the ability to select an item in listview and long tap on an item too.

Any help is appreciated.

1
  • Here's an Excellent Answer Commented Dec 9, 2011 at 7:23

1 Answer 1

1

It is very simple.....

IN your XML file where you have the <CheckBox> </CheckBox> put android:focusable="false"

So the end should look like this >>>

<CheckBox>...android:focusable="false"...</CheckBox>  
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.