Does anyone know what the appropriate mechanism is when creating a custom composite control to apply state changes from the container to all children? It seems to me that there should be an easy way to configure the ViewGroup to forward all state changes (pressed, enabled, etc.) to each child.
For example, if I create my own widget line by line:
public class MyWidget extends RelativeLayout { private TextView mTitleView, mValueView; private ImageView mImageView; public ValueButton(Context context) { this(context, null); } public ValueButton(Context context, AttributeSet attrs) { super(context, attrs);
In many cases, there are paintable lists or colors attached to child elements that I want to switch when the changes apply to the overall widget as a whole. What do I need to add to a similar widget so that, for example, when I call MyWidget.setEnabled() or when MyWidget clicked, do these state changes filter the hierarchy?
Thanks!
source share