私は個人的な予算についてAndroidアプリケーションを開発しています。トランザクションを一覧表示するときは、を使用してListView
います。ListView
に、すべて異なるバックグラウンドリソースを持つ収入、費用、および転送トランザクションを示します。しかし、リストビューまで下にスクロールして再び表示すると、背景画像が変わります。誰かがそのように起こった理由を教えてもらえますか?
これは私のコード例です。
public View getView(int position, View convertView, ViewGroup parent) {
View vi=convertView;
if(convertView==null)
vi = inflater.inflate(R.layout.transactionline, null);
transaction.setType(Integer.parseInt(item.get("Type")));
if(transaction.getType()==1){
anaalan.setBackgroundResource(R.anim.greenbutton);
}else if(transaction.getType()==3)
{
anaalan.setBackgroundResource(R.anim.buttonstyle);
}
return vi;
}