两种不同布局中的android listview消息
|我的申请几乎成功了。现在我在最后阶段。在动态列表视图中显示发送和接收的消息时,我遇到了一个问题。根据发送或接收的数据,我需要在listview中显示文本。我可以在中查看已发送的邮件。我能够从接收方接收消息,但无法在列表视图中显示该消息 示例代码:两种不同布局中的android listview消息,android,listview,Android,Listview,|我的申请几乎成功了。现在我在最后阶段。在动态列表视图中显示发送和接收的消息时,我遇到了一个问题。根据发送或接收的数据,我需要在listview中显示文本。我可以在中查看已发送的邮件。我能够从接收方接收消息,但无法在列表视图中显示该消息 示例代码: public View getView(int position, View convertView, ViewGroup parent) { LayoutInflater inflater = getLayoutInflat
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = getLayoutInflater();
View row;
String query = null;
// String even_color, odd_color;
SharedPreferences prefList = getSharedPreferences("PrefsFile",
MODE_PRIVATE);
if(query == data){
row = inflater.inflate(R.layout.list_row_layout_odd, parent,
false);
TextView textLabel = (TextView) row.findViewById(R.id.text);
textLabel.setText(data);
}
else
{
row = inflater.inflate(R.layout.list_row_layout_even, parent,
false);
TextView textLabel = (TextView) row.findViewById(R.id.text);
textLabel.setText(datas);
}
return row;
}
}
如果我发送消息,我需要在ie(列表行布局奇数)中显示消息,如果我收到消息,我需要在(列表行布局偶数)布局中显示消息
请帮我解决这个问题
提前谢谢。试试充气机。充气(R.layout.list_row_layout_odd,null)?谢谢你的回复。但不起作用。我需要根据操作(发送和接收)在同一列表视图中查看这两个布局。任何其他想法…请找到下面的链接了解logcat详细信息。。提前谢谢。