チャットメッセンジャーのようなアプリを開発するつもりです
テキストを送信するたびに、リストビューの左側に表示され、返信が右側に表示され
ますアイテム
の位置が偶数であるため、アイテムが奇数の位置にある場合は左側に表示され、偶数の場合は右側に表示されます。
BaseAdapter を拡張することによって
public View getView(int position, View convertView, ViewGroup parent) {
LayoutInflater inflater = getLayoutInflater();<br>
View row;<br>
if (position % 2 == 0) {<br>
row = inflater.inflate(R.layout.list_row_layout_even,parent,false);
TextView textLabel = (TextView) row.findViewById(R.id.text);
textLabel.setText(arraylist.get(position));
} else {
row = inflater.inflate(R.layout.list_row_layout_odd, parent,
false);
TextView textLabel = (TextView) row.findViewById(R.id.text);
textLabel.setText(arraylist.get(position));
}
return (row);
}
しかし今、私はそれを私が望む側に置きたいと思っています。つまり、位置はアイテムの位置と独立していなければならないということです。古いレイアウト。
それは可能ですか?どんな助けでも大歓迎です!ありがとう