チャットウィンドウを実装しています。4.2 エミュレータでは正常に動作していますが、2.3.3 エミュレータでは奇妙な動作をします。にデータを入力するカスタムAdapter
拡張を実装しました。誰のメッセージを表示するかに基づいて、リストを更新しています。エミュレーター 4.2 は必要に応じてリストを更新していますが、2.3.3 のリストでは最後に選択した項目で更新されます。これが私の関数のコードです。BaseAdapter
ListVIew
ListView
items
getView
public View getView(int position, View convertView, ViewGroup parent) {
View chatItem = convertView;
if (chatItem == null) {
if (position % 2 == 0) //TODO: Change it to arrayListChat.getUpdater
chatItem = ((LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.chat_item_me, parent, false);
else
chatItem = ((LayoutInflater) activity.getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(R.layout.chat_item_support, parent, false);
ChatListItemViewHolder viewHolder = new ChatListItemViewHolder();
viewHolder.textViewChat = (TextView) chatItem.findViewById(R.id.textViewChat);
chatItem.setTag(viewHolder);
}
ChatListItemViewHolder viewHolder = (ChatListItemViewHolder) chatItem.getTag();
viewHolder.textViewChat.setText(arrayListChat.get(position).getMessage());
return chatItem;
}
画像へのリンク
エミュレータ 4.2 http://i.imgur.com/p7LpICm.png
エミュレーター 2.3.3 http://i.imgur.com/fxPrEdm.png
ありがとう