Android 如何自定义simple\u list\u item\u multiplechoice.xml文件
在这里,我使用此代码显示带有复选框的联系人Android 如何自定义simple\u list\u item\u multiplechoice.xml文件,android,Android,在这里,我使用此代码显示带有复选框的联系人 SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, android.R.layout.**simple_list_item_multiple_choice,c**, new String[] { //Phone.TYPE,
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** });
工作正常..但不显示联系人号码..只显示姓名和每行的复选框。为此,我创建了自己的布局并放置了main,而不是简单的列表项目,如下所示
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** });
但其显示为main的错误无法解决或不是字段
你能解决我的问题吗..提前谢谢只需使用
R.layout.main
而不使用android
前缀。使用此布局中的所有ID(也不带前缀)