In my current project styles.xml I try to define:
<resources xmlns:ripple="http://schemas.android.com/apk/res-auto">
<resources xmlns:ripple="http://schemas.android.com/apk/res/com.gorkem.components">
and I use this:
<style name="FlatTextRipple">
<item name="ripple:rv_centered">true</item>
<item name="ripple:rv_color">#CCCCCC</item>
<item name="ripple:rv_type">simpleRipple</item>
<item name="ripple:rv_zoom">true</item>
<item name="ripple:rv_zoomDuration">300</item>
</style>
and in my library project I have attrs.xml:
<declare-styleable name="RippleView">
<attr name="rv_alpha" format="integer" />
<attr name="rv_framerate" format="integer" />
<attr name="rv_rippleDuration" format="integer" />
<attr name="rv_zoomDuration" format="integer" />
<attr name="rv_color" format="color" />
<attr name="rv_centered" format="boolean" />
<attr name="rv_type" format="enum">
<enum name="simpleRipple" value="0" />
<enum name="doubleRipple" value="1" />
<enum name="rectangle" value="2" />
</attr>
<attr name="rv_ripplePadding" format="dimension" />
<attr name="rv_zoom" format="boolean" />
<attr name="rv_zoomScale" format="float" />
</declare-styleable>
But I don't understand when Í use it like in layout it is running but when I use style.xml gradle can not attr and it gives me this error :
Error:(6, 21) No resource found that matches the given name: attr 'ripple:rv_centered'.
Error:(7, 21) No resource found that matches the given name: attr 'ripple:rv_color'.
Error:(8, 21) No resource found that matches the given name: attr 'ripple:rv_type'.
Error:(9, 21) No resource found that matches the given name: attr 'ripple:rv_zoom'.
Styles don't match what you do in layouts. In your
styles.xml
, remove your customxmlns
declaration, and just use the attributes directly with no prefix, like so: