代码如下:
Cursor cursor = mydatabasehelper.fetchAllData1(type);
if(cursor != null){
while (cursor.moveToNext()) {
String name = cursor.getString(cursor.getColumnIndex("type"));
Log.v("info", "类型是 " + name );
if (cur != null && name.equals("发送")) { //1213
System.out.println("发送(green)++++++++++++");
simpleadapter = new SimpleCursorAdapter(this,R.layout.list_say_he_item,cur,
new String[] {"type","det","tim" }, new int[] {R.id.neirong,R.id.single_text,R.id.tim2});
}else{
System.out.println("接收(white)————————");
simpleadapter = new SimpleCursorAdapter(this,R.layout.singletext,cur,
new String[] {"type","det","tim" }, new int[] {R.id.send_receive_text,R.id.single_text,R.id.tim2});
}
setListAdapter(simpleadapter);
simpleadapter.notifyDataSetChanged();
}
cursor.close();
}
得到结果老是只显示一种layout,如何在会话中根据name的值,显示不同layout,求大神帮忙android短信会话
Cursor cursor = mydatabasehelper.fetchAllData1(type);
if(cursor != null){
while (cursor.moveToNext()) {
String name = cursor.getString(cursor.getColumnIndex("type"));
Log.v("info", "类型是 " + name );
if (cur != null && name.equals("发送")) { //1213
System.out.println("发送(green)++++++++++++");
simpleadapter = new SimpleCursorAdapter(this,R.layout.list_say_he_item,cur,
new String[] {"type","det","tim" }, new int[] {R.id.neirong,R.id.single_text,R.id.tim2});
}else{
System.out.println("接收(white)————————");
simpleadapter = new SimpleCursorAdapter(this,R.layout.singletext,cur,
new String[] {"type","det","tim" }, new int[] {R.id.send_receive_text,R.id.single_text,R.id.tim2});
}
setListAdapter(simpleadapter);
simpleadapter.notifyDataSetChanged();
}
cursor.close();
}
得到结果老是只显示一种layout,如何在会话中根据name的值,显示不同layout,求大神帮忙android短信会话
第一个layout,发送时这样显示:
当收到信息时,显示为
这时应该调用第二个layout界面,但是为什么发送的那条信息的显示界面也变成第二个的了?