I am using a TextView inside a LinearLayout for GridView's cell. The TextView is supposed to animate(like button) in pressed state, for which I am using drawable property. Everything is fine apart from the fact that the rectangular Grid cell gets little darken even outside circle, which i wasn't expecting. This is shown in the image below.
Question: What is it called and How to avoid it?
The XML resources are as follows:
Layout used for grid cell
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/id_gridCell"
android:background="@drawable/circularbutton_selector"
android:layout_margin="0dp"
android:gravity="center_horizontal|center_vertical"
android:textSize="40dp"
android:text="-"
android:layout_gravity="center_horizontal|center_vertical"
android:elevation="5dp"
/>
circularbutton_selector.xml
<item android:state_selected="true"
android:drawable="@drawable/circularbutton_selected"/>
<item android:state_pressed="true"
android:drawable="@drawable/circularbutton_pressed"/>
<item android:drawable="@drawable/circularbutton"/>
circularbutton_pressed
<solid android:color="@color/accent_material_light"/>
<stroke android:width="2dp" android:color="#AAA"/>
that should be the listSelector
property of GridView
and ListView
. Add
android:listSelector="#00000000"
or
android:listSelector="@null"
to the xml
of your <GridView