views:

134

answers:

1

Hi , i want to remove the default orange focus color from GridView and from the EditText. I have tried the android:focusable="false" but it is not working.Can any one help me if you have gone through this problem before?????

Thanks in advance.

A: 

I think if this works as the other views, you have to use a selector in which you define various states for your view. A selector is a drawable (stored in the drawable folder) and you use it as if it was just an image. For instance, you could do something like that, if you want the focus to be red instead of orange : selectorgridview.xml :

<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android"&gt;
  <item android:state_focused="true" android:color="@color/darkred" />
  <item android:color="@color/white" />
</selector>

Then, you put the background of your GridView with it : android:background="selectorgridview"
I actually never tried it on a GridView but I think it works as the other views. More infos in the docs from google

Sephy
no it's not not working.
Sujit
well, one thing that i'm sure of is that you can add this : android:listSelector="#00000000" to your gridview xml file. This will remove any kind of background of the gridview. I'm still looking for the way to do that view by view.
Sephy
yes that's right i have done exactly like this and its working now...thanks
Sujit