[android-developers] Re: Forcing an item in a GridView to remain highlighted after clicking

2012-01-20 Thread jamesc
Create a new selector (see 
http://developer.android.com/guide/topics/resources/drawable-resource.html#StateList)
for the item, and then configuring the colour/background values
depending on state. By state, I mean, your item could be
'Checkable' (i.e. only a single item in the whole GridView can be
checked at a time) and then when it's tapped, set it to checked, and
the appropriate value in the selector would be chosen. Alternatively,
you could use the item's .setEnabled() method and do something
similar.

You may also need to be aware of the android:duplicateParentState
attribute.

On Jan 20, 6:10 am, rperi...@yahoo.com rperi...@yahoo.com wrote:
 I would like to make the blue border around a gridview item remain
 highlighted after clicking on it as a reminder to the user which item
 was slected while making the second choice. I have tried a number of
 methods from the View class and none of them seem to have any effect -
 the border disappears after a short while. Any ideas how to do this?

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en


[android-developers] Re: Forcing an item in a GridView to remain highlighted after clicking

2012-01-20 Thread rperi...@yahoo.com
Okay thanks I will look into what you suggest. I did try the
setEnabled() method as well as setSelected() method among other things
and they all had no effect. I assumed the item would assume the
default behaviour in terms of selected color. But I will try
explicitly specifying that and see if it works.

On Jan 20, 2:02 am, jamesc jame...@gmail.com wrote:
 Create a new selector 
 (seehttp://developer.android.com/guide/topics/resources/drawable-resource...)
 for the item, and then configuring the colour/background values
 depending on state. By state, I mean, your item could be
 'Checkable' (i.e. only a single item in the whole GridView can be
 checked at a time) and then when it's tapped, set it to checked, and
 the appropriate value in the selector would be chosen. Alternatively,
 you could use the item's .setEnabled() method and do something
 similar.

 You may also need to be aware of the android:duplicateParentState
 attribute.

 On Jan 20, 6:10 am, rperi...@yahoo.com rperi...@yahoo.com wrote:



  I would like to make the blue border around a gridview item remain
  highlighted after clicking on it as a reminder to the user which item
  was slected while making the second choice. I have tried a number of
  methods from the View class and none of them seem to have any effect -
  the border disappears after a short while. Any ideas how to do this?- Hide 
  quoted text -

 - Show quoted text -

-- 
You received this message because you are subscribed to the Google
Groups Android Developers group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en