package com.qiyou.mb.android.utils;

import java.util.List;
import java.util.Map;

import com.qiyou.mb.android.R;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.SimpleAdapter;

public class QSimpleAdapter extends SimpleAdapter{

	public QSimpleAdapter(Context context, List<? extends Map<String, ?>> data,
			int resource, String[] from, int[] to) {
		super(context, data, resource, from, to);
		// TODO Auto-generated constructor stub
	}
//	int[] colors={R.color.floralwhite,R.color.white };
//	int[] colors={R.color.lightcyan,R.color.ivory };
	int[] colors={R.color.ivory,R.color.snow };//R.color.lightcoral
	//int[] colors={R.color.lightgray,R.color.lightpink };
	//int[] colors={R.color.springgreen,R.color.silver }; 
//	int selectedColor=R.color.blanchedalmond;
	int selectedColor=R.color.silver;
	
	@Override 
	public View getView(int position, View convertView, ViewGroup parent){
		View v =super.getView(position, convertView, parent);  
	    v.setBackgroundResource(colors[position%2]); 
	    if (position == selectItem) {
			v.setBackgroundResource(selectedColor);
		} 
	    v.getBackground().setAlpha(150);
		return v; 
	}
	 
	
	
	public  void setSelectItem(int selectItem) {
		 this.selectItem = selectItem;
	}
	private int  selectItem=-1;
}
