title: Android : GridLayout Highlight A Row
body: <p><br> I am writing a feedback screen for my app and using grid layout for it. <br> It is a static form which shows and image and text description.<br>I want to highlight the selected item so user is aware of the click event.<br> While <code>listSelector</code> to set a background drawable was not available for gridlayout; <code>refNowTxt.setBackgroundColor(getResources().getColor(R.color.frame_background))</code> did not highlight the entire row. <br>I am thinking on retrieving the selected row and setting a background to highlight. <br> Appreciate any help on this.<br>Following is my layout.xml:  </p>
  
  <pre><code>&lt;GridLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:useDefaultMargins="true"
      android:alignmentMode="alignBounds"
      android:columnOrderPreserved="false"
      android:columnCount="2"
      android:orientation="horizontal"
      android:rowCount="7"
      android:paddingTop="6dp"&gt;
  
      &lt;ImageView
          android:id="@+id/imgWriteFeedback"
          android:layout_width="wrap_content"
          android:layout_gravity="left"
          android:layout_row="0"
          android:layout_column="0"
          android:src="@drawable/write_to_us"
          android:paddingTop="6dp"
          android:paddingLeft="6dp"
          android:paddingRight="6dp"
          android:paddingBottom="6dp"/&gt;
  
      &lt;TextView
          android:id="@+id/lblWriteFeedback"
          android:layout_row="0"
          android:layout_column="1"
          android:textSize="20sp"
          android:gravity="left"
          android:textColor="@android:color/black"
          android:layout_marginLeft="5dp"
          android:text="@string/write_to_us"
          android:paddingTop="6dp"
          android:layout_gravity="left"
          /&gt;
  
      &lt;LinearLayout
          android:layout_width="fill_parent"
          android:layout_height="1px"
          android:layout_marginTop="3dp"
          android:background="@color/frame_background"
          android:orientation="horizontal"
          android:layout_columnSpan="2"/&gt;
  
      &lt;ImageView
          android:id="@+id/imgRateUs"
          android:layout_width="wrap_content"
          android:layout_gravity="left"
          android:layout_row="1"
          android:layout_column="0"
          android:src="@drawable/rate_us_resized"
          android:paddingTop="6dp"
          android:paddingLeft="6dp"
          android:paddingRight="6dp"
          android:paddingBottom="6dp"/&gt;
  
      &lt;TextView
          android:id="@+id/lblRateUs"
          android:layout_row="1"
          android:layout_column="1"
          android:textSize="20sp"
          android:gravity="left"
          android:textColor="@android:color/black"
          android:layout_marginLeft="5dp"
          android:paddingTop="6dp"
          android:text="@string/rate_us"
          /&gt;
  
      &lt;LinearLayout
          android:layout_width="fill_parent"
          android:layout_height="1px"
          android:layout_marginTop="3dp"
          android:background="@color/frame_background"
          android:orientation="horizontal"
          android:layout_columnSpan="2"/&gt;
  
      &lt;ImageView
          android:id="@+id/imgShareApp"
          android:layout_width="wrap_content"
          android:layout_gravity="left"
          android:layout_row="2"
          android:layout_column="0"
          android:src="@drawable/share_resized"
          android:paddingTop="6dp"
          android:paddingLeft="6dp"
          android:paddingRight="6dp"
          android:paddingBottom="6dp"/&gt;
  
      &lt;TextView
          android:id="@+id/lblShareApp"
          android:layout_row="2"
          android:layout_column="1"
          android:textSize="20sp"
          android:gravity="left"
          android:textColor="@android:color/black"
          android:layout_marginLeft="5dp"
          android:paddingTop="6dp"
          android:text="@string/share_app"
          /&gt;
  
      &lt;LinearLayout
          android:layout_width="fill_parent"
          android:layout_height="1px"
          android:layout_marginTop="3dp"
          android:background="@color/frame_background"
          android:orientation="horizontal"
          android:layout_columnSpan="2"/&gt;
  
  &lt;/GridLayout&gt;
  </code></pre>
  
  <p>` <a href="https://i.stack.imgur.com/OZ140.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OZ140.jpg" alt="enter image description here"></a> </p>