I'm looking on how I can change the color of the selected item on ListView, so I can give the user better way to use my application, so when clicking on a ListView item, the color of the item changes, or any cool animation.
I'm using an adapterView for my Listview : here is the code :
public class adapterq extends ArrayAdapter<Questionaire> {
Bitmap image;
public adapterq(Context context, ArrayList<Questionaire> questionaires) {
super(context, 0, questionaires);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
final Questionaire c = getItem(position);
View convertView2;
if (convertView == null) {
convertView = LayoutInflater.from(getContext()).inflate(R.layout.customquest, parent, false);
convertView2 = LayoutInflater.from(getContext()).inflate(R.layout.activity_main, parent, false);
}else{
convertView2 = (View) convertView.getTag();
}
TextView q = (TextView) convertView.findViewById(R.id.textView1);
final EditText name = (EditText) convertView2.findViewById(R.id.editText1);
q.setText(c.getLabel());
convertView.setOnClickListener(new OnClickListener(){
@Override
public void onClick(View v) {
Intent intent = new Intent();
intent.setClass(getContext(), Questions.class);
intent.putExtra("name", name.getText().toString());
intent.putExtra("category", c.getCode());
getContext().startActivity(intent);
}
});
convertView.setTag(convertView2);
return convertView;
}
}
Here is a screenshot of my amazing Listview :