I have a LinearLayout with some other LinearLayouts inside. The children layouts have a background selector set. I need to change the color of the parent layout as well when a children is pressed. I have set a background selector as well for the parent, but it only triggers when clicking outside of any children.
How can I avoid this?
Thanks!
Try adding this to the layout attributes for the parent LinearLayout:
Alternatively, in code call:
In either case, be sure that the child layouts do not have the
android:duplicateParentStateattribute set (and do not callsetDuplicateParentState(true)), or you will get an exception at run time when the system detects the circular dependency.