I have read and understood https://stackoverflow.com/a/5052401/305532, however what I want is not to generally style and override individual widget styles, but styles that are part of sub-widgets.
Say, I have a compound RelativeLayout
that consists of a standard EditText
and a standard Button
. I could override android:buttonStyle
to style this Button
, but what I really want is
<my.custom.Widget
...
pkg:buttonStyle="@style/CustomStyle" />
where the CustomStyle
could derive from android:style/Widget.Button
, but would be changeable for each instance of my.custom.Widget
because of pkg:buttonStyle
.
The only alternative I know is to add all styleable attributes individually into my attrs.xml
(with the usual conflicts in case two or more of your sub-widgets need the same attribute, but with different values) and then manually copying / setting all these attributes in my.custom.Widget
's constructor / init method.
Is there a way to achieve this?