0

I have a listview with 4 rows. I'd like that the first row has a checkbox but the other rows just keep plain clickable rows. Is this possible to do or do I need to create 2 listviews and put them underneath each other and make the first listview with a custom adapter?

Or is there a better way to do this?

Summary: I'd like to have a listview with the first row to be clicked and that checkbox changes states and the other rows just keep acting as rows. Best way to do this by making 2 listview 1 with custom view and a normal one? Or is it possible to do this in 1 listview?

1
  • Set it as header view for list Commented May 9, 2013 at 14:45

1 Answer 1

2

Create your custom adapter. In getView() method check

if(position == 0)
{
    //add your checkbox
}
else
{
    //without checkbox
}
Sign up to request clarification or add additional context in comments.

2 Comments

See this answer, should be pretty effective and simple.
This doesn't work for a CursorAdapter. I think because CursorAdapter tries to be more efficient by pulling only groups of data at a time, rather than everything like an ArrayAdapter would do.

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.