How to: Define theme (style) item for custom widget
Yes, there’s one way: Suppose you have a declaration of attributes for your widget (in attrs.xml): <declare-styleable name=”CustomImageButton”> <attr name=”customAttr” format=”string”/> </declare-styleable> Declare an attribute you will use for a style reference (in attrs.xml): <declare-styleable name=”CustomTheme”> <attr name=”customImageButtonStyle” format=”reference”/> </declare-styleable> Declare a set of default attribute values for the widget (in styles.xml): <style name=”Widget.ImageButton.Custom” parent=”android:style/Widget.ImageButton”> … Read more