Reputation: 333
I am developing a simple android application for learning gridview. My requirement is to create a 2x2 grid which changes colours dynamically like a serial light circuit one by one, and others should be in white colour.
Please suggest a way to do this.
Upvotes: 0
Views: 484
Reputation: 1010
Create custom ArrayAdapter
new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, student_array) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View view = super.getView(position, convertView, parent);
int color = 0x00FFFFFF; // Transparent
if (condition) {
color = 0x00000000; // Black
}
view.setBackgroundColor(color);
return view;
}
};
Upvotes: 1