how to change background color of grid in grid layout in android

Solutions on MaxInterview for how to change background color of grid in grid layout in android by the best coders in the world

showing results for - "how to change background color of grid in grid layout in android"
Harley
15 Nov 2018
1new ArrayAdapter<String>(context, android.R.layout.simple_list_item_1, student_array) {
2  @Override
3  public View getView(int position, View convertView, ViewGroup parent) {
4    View view = super.getView(position, convertView, parent);
5
6    int color = 0x00FFFFFF; // Transparent
7    if (someCondition) {
8      color = 0xFF0000FF; // Opaque Blue
9    }
10
11    view.setBackgroundColor(color);
12
13    return view;
14  }
15};
16