Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

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

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 (someCondition) {
      color = 0xFF0000FF; // Opaque Blue
    }

    view.setBackgroundColor(color);

    return view;
  }
};
Comment

PREVIOUS NEXT
Code Example
Java :: click on recyclerview item android animation 
Java :: HOW TO START ACTIVITY FROM FRAGMENT INSIDE? 
Java :: how to make a rest api in spring 
Java :: fibonacci of 6 
Java :: java stream add to existing list 
Java :: arrondi java 
Java :: reverse a doubly linked list 
Java :: java double 
Java :: get field name java 
Java :: Java empty() Method 
Java :: what is the max size of array in java 
Java :: flutter doctor Unable to find bundled Java version. 
Java :: call by value and call by reference in java 
Java :: Set icon for toolbar android 
Java :: Java @Deprecated annotation 
Java :: java printwriter create file 
Java :: Java Create a ByteArrayOutputStream 
Java :: java collectors mapping 
Java :: Passing data from an activity to a fragment 
Java :: knapsack problem 
Java :: run specific test case junit 
Java :: remove an element from an array in java 
Java :: method overloading 
Java :: how to encrypt password in properties file in spring boot 
Java :: kafkalistener annotation pass topic from properties file 
Java :: java truncate bigdecimal 
Java :: madrid 
Java :: read and existing dir content in java 
Java :: .code domain 
Java :: expression régulière seulement un espace java 
ADD CONTENT
Topic
Content
Source link
Name
2+8 =