Note that there are some explanatory texts on larger screens.

plurals
  1. POAndroid GridView Selected Item Background
    text
    copied!<p>My GridView Not Show Pressed and Focused Selector My Code is Below.</p> <p><strong>myhomegrid.xml</strong></p> <pre><code>&lt;GridView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/gwMenu" android:layout_width="fill_parent" android:layout_height="fill_parent" android:numColumns="auto_fit" android:verticalSpacing="10dp" android:horizontalSpacing="10dp" android:columnWidth="90dp" android:stretchMode="columnWidth" android:gravity="center" android:drawSelectorOnTop="true" android:listSelector="@layout/grid_selector" /&gt; </code></pre> <p><strong>grid_selector.xml</strong></p> <pre><code>&lt;selector xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:state_pressed="true" android:drawable="@drawable/pressedback" /&gt; &lt;item android:state_window_focused="false" android:drawable="@drawable/focusedback" /&gt; &lt;item android:state_window_focused="true" android:drawable="@drawable/focusedback" /&gt; &lt;/selector&gt; </code></pre> <p><strong>menu.xml</strong></p> <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/widget44" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="vertical" android:layout_x="201px" android:layout_y="165px" android:gravity="center_horizontal"&gt; &lt;ImageView android:id="@+id/icon_image" android:layout_width="wrap_content" android:layout_height="wrap_content"&gt; &lt;/ImageView&gt; &lt;TextView android:id="@+id/icon_text" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="TextView" android:gravity="center_horizontal" android:textColor="#ffffff" android:textColorHighlight="#656565"&gt; &lt;/TextView&gt; &lt;/LinearLayout&gt; </code></pre> <p>Focused Image</p> <p><img src="https://i.stack.imgur.com/vom2H.png" alt="enter image description here"></p> <p>Pressed Image</p> <p><img src="https://i.stack.imgur.com/Y7fD5.png" alt="enter image description here"></p> <p>I want to seletor like below image:</p> <p><img src="https://i.stack.imgur.com/2BCMA.png" alt="enter image description here"></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload