views:

35

answers:

1

I am using a Gallery view where the view corresponding to each item is non-trivial and consists of text as well as multiple buttons.

When I click to drag the gallery view (somewhere not on one of the buttons) the button's drawable state changes to pressed and appears as if all of the buttons are currently being pressed. Additionally, the same behavior happens for the selected state (e.g. all of the text of the child TextViews changes color).

I am trying to prevent this behavior and have found the android:duplicateParentState xml attribute as well as the setDuplicateParentStateEnabled property. This seems like it should accomplish what I am trying to do, but it seems to have no effect.

Any ideas?

A: 

Not sure where the duplicateParentState property comes into play, but breaking through the source shows that it is never taken into account for the selected and pressed states. I would up creating a custom view class and overriding the dispatchSetSelected and dispatchSetPressed methods.

Gordon