Hi Dan,

android.R.layout.simple_list_item_multiple_choice and
android.R.layout.simple_list_item_1 actually refer to built-in android
layouts, so for example:

http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/res/res/layout/simple_list_item_multiple_choice.xml

Note that for this particular layout, there is only a "text1".

I think what you want to do, is define your own layout under
"res/layout". You could base it off of preference.xml:

http://android.git.kernel.org/?p=platform/frameworks/base.git;a=blob;f=core/res/res/layout/preference.xml

You'll have to modify it to include a checkbox inside widget_frame.
Also the ids would be android.R.id.title and android.R.id.summary.

Cheers,
James

On Fri, Jan 30, 2009 at 3:31 AM, Dan Dromereschi
<[email protected]> wrote:
>
> Hi James,
>
> Sure, the code snippet is below:
>
>    mList.setItemsCanFocus(false);
>    mList.setChoiceMode(ListView.CHOICE_MODE_MULTIPLE);
>    mListAdapter = new SimpleAdapter(this, mListValues,
> android.R.layout.simple_list_item_multiple_choice,
>        new String[] {"name", "desc"}, new int[] {android.R.id.text1,
> android.R.id.text2});
>    mList.setAdapter(mListAdapter);
>
> Considering text1 as the item text, text2 as the item summary (the
> smaller text below the item text), when running the code above, only
> text1 and the checkbox are displayed.
> If in the code above I replace the resource that currently has the
> android.R.layout.simple_list_item_multiple_choice value with
> android.R.layout.simple_list_item_2, I can see both text1 and text2.
> If I try to "OR" the 3 values:
> android.R.layout.simple_list_item_multiple_choice |
> android.R.layout.simple_list_item_1 |
> android.R.layout.simple_list_item_2, as I was used to when writing SWT
> based applications, nothing is displayed.
>
> So, I am not sure how to make all the 3 things displaying.
>
> Thanks,
>
> Dan
>
>
> On Jan 29, 8:17 pm, James Yum <[email protected]> wrote:
>> Hi Dan,
>> Can you post some code?
>>
>> Cheers,
>> James
>>
>> On Thu, Jan 29, 2009 at 6:31 AM, Dan Dromereschi
>> <[email protected]>wrote:
>>
>>
>>
>> > Hello,
>>
>> > I am trying to build a ListView that contains items that look exactly
>> > like the CheckBoxPreference, an android.R.id.text1, an
>> > android.R.id.text2 and a checkbox.
>>
>> > I am using a SimpleAdapter and I manage to either have only text1 and
>> > the checkbox, or text1 and text2, but never all the 3 of them. Is
>> > there something I am missing?
>>
>> > Thanks,
>>
>> > Dan
>>
>>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to