私は ListView ベースのアプリに取り組んでいますが、非常に奇妙な問題があります。ListItems が再表示され、正しいアイテムが正しい場所に表示されません。これを理解しやすくするために、各 ListItem のテキストをその位置と同じになるように設定しました。私はアダプターの getView() 呼び出しでこれを行っています。Nexus 7 4 を持っている場合、ListItems が表示されます。合計 10 個の ListItems がある場合、0、1、3、4、0、1、2、3、4 のようになります。これはすべてのデバイスに適用され、最初に画面に表示されるアイテムの数 + 1 が正しいことを意味します。他のすべての ListItems は再配置されます。
私のコードのどの部分に問題があると思いますか?なぜなら、今私は何時間もこれを修正しようとしてきましたが、私は無知だからです. すべてのヘルプは非常に高く評価されています。
編集:
ここに私の getView() があります:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
CountdownItem ci = mTitle.get(position);
if (convertView == null) {
convertView = mInflater.inflate(R.layout.list_item, parent, false);
holder = new CountdownViewHolder();
holder.mTitle = (TextView) convertView.findViewById(R.id.textPrim);
holder.mSubtitle = (TextView) convertView
.findViewById(R.id.textSec);
holder.mDayProgress = (ProgressBar) convertView
.findViewById(R.id.day_progress);
holder.mMonthProgress = (ProgressBar) convertView
.findViewById(R.id.month_progress);
holder.mYearText = (TextView) convertView
.findViewById(R.id.year_text);
holder.day_help = (TextView) convertView
.findViewById(R.id.day_help);
holder.month_help = (TextView) convertView
.findViewById(R.id.month_help);
holder.setTitle(Integer.toString(position) + " Title");
holder.setSubtitle(ci.getSubtitle());
holder.fixImageAndText(position);
convertView.setTag(holder);
} else {
holder = (CountdownViewHolder) convertView.getTag();
}
return convertView;
}