我有一个更新的列表视图 问题是在更新后它会改变它的颜色 这里有一个样本照片 请hlp 好多了
http://s14.postimg.org/xi6dcyb35/before.png http://s11.postimg.org/71m596bmr/after_update.png
这是适配器代码
公共类ZakazCursorAdapter扩展了SimpleCursorAdapter {
private ZakazesDataSource datasource;
LayoutInflater lInflater;
Cursor kursor;
Context ctx;
CheckedTextView m_calCheckText;
String Log_TAG;
Typeface tp;
public ZakazCursorAdapter(Context context, int layout, Cursor c,
String[] from, int[] to, int flags) {
super(context, layout, c, from, to, flags);
kursor = c;
ctx = context;
}
@SuppressLint("ResourceAsColor")
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View currView = super.getView(position, convertView, parent);
CheckedTextView checkedTextView = (CheckedTextView) currView.findViewById(R.id.smsDate);
TextView uddd = (TextView) currView.findViewById(R.id.uid);
TextView krorder2 = (TextView) currView.findViewById(R.id.kurorder2);
TextView rmk = (TextView) currView.findViewById(R.id.zakRemark);
TextView rmk1 = (TextView) currView.findViewById(R.id.smsDate);
TextView rmk2 = (TextView) currView.findViewById(R.id.order1);
TextView rmk3 = (TextView) currView.findViewById(R.id.order2);
TextView rmk4 = (TextView) currView.findViewById(R.id.order4);
TextView rmk5 = (TextView) currView.findViewById(R.id.order3);
TextView rmk6 = (TextView) currView.findViewById(R.id.order5);
TextView rmk7 = (TextView) currView.findViewById(R.id.zakazno);
TextView rmk8 = (TextView) currView.findViewById(R.id.smsMessage12);
return currView;
}
public List<Integer> getCheckedItemPositions(Cursor c) {
List<Integer> checkedItemPositions = new ArrayList<Integer>();
for (int i = 0; i < myChecked.size(); i++) {
if (myChecked.get(i)) {
(checkedItemPositions).add(i);
}
}
return checkedItemPositions;
}
public List<String> getCheckedItems(Cursor c) {
List<String> checkedItems = new ArrayList<String>();
for (int i = 0; i < c.getCount(); i++)
{
//Log.d(Log_TAG, " row: " + c.getPosition() +"-"+c.getCount());
c.moveToPosition(i);
if (myChecked.containsKey(c.getString(11))) {
if (myChecked.get(c.getString(11)) == true)
{
String name = c.getString(c.getColumnIndex("zkucode"));
(checkedItems).add(name);
Log.d(Log_TAG, " ifinicendeki: " + c.getPosition() +"-"+c.getString(11) + "-" + myChecked.get(c.getString(11)));
String result = " ifinicendeki: " + c.getPosition() +"-"+c.getString(11) + "-" + myChecked.get(c.getString(11));
//Toast.makeText(ctx, result, Toast.LENGTH_SHORT).show();
String hemmesi = "";
Set<String> sortedKeys = new TreeSet<String>();
sortedKeys.addAll(myChecked.keySet());
for(String key: sortedKeys){
hemmesi += (key + ":" + myChecked.get(key)) + "\n";
}
//Toast.makeText(ctx, hemmesi, Toast.LENGTH_SHORT).show();
}
}
else
{
Log.d(Log_TAG, " ifinicendeki yok: " + c.getPosition() +"-"+c.getInt(11) + "-" + myChecked.get(c.getInt(11)));
}
}
return checkedItems;
}
}