开发者

how to customize simple_list_item_multiplechoice.xml file

here i used this code to display contacts with check boxes....

SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
                android.R.layout.**simple_list_item_multiple_choice,c**,
                        new String[] {
                            //Phone.TYPE,
                            Phone.DISPLAY_NAME,
                            Phone.NUMBER
                        },
                        new int[] { android.R.id.**text1**, android.R.id.**text2** });

its working well ..but not showing contact number..showing only name with checkboxes each row.to do this ,i created my ownlayout and placed main instead of simple_list_itemmultiplechoice as below

SimpleCursorAdapter adapter = new SimpleCursorAdapter(this,
                android.R.layout.**main**,c,
                        new String[] {
                            //Phone.TYPE,
       开发者_高级运维                     Phone.DISPLAY_NAME,
                            Phone.NUMBER
                        },
                        new int[] { android.R.id.**text_name**, android.R.id.**text_phone** });

but its showing error as main cannot be resolved or is not a field

can u solve my problem..thanks in advance


Just use R.layout.main without android prefix. Use all ids from this layout without prefix too.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜