Android 样式中的自定义属性

Android 样式中的自定义属性,android,android-gradle-plugin,custom-attributes,android-custom-attributes,Android,Android Gradle Plugin,Custom Attributes,Android Custom Attributes,在我当前的project styles.xml中,我尝试定义: <resources xmlns:ripple="http://schemas.android.com/apk/res-auto"> <resources xmlns:ripple="http://schemas.android.com/apk/res/com.gorkem.components"> 样式与布局中的样式不匹配。在styles.xml中,删除自定义的xmlns声明,只需直接使用属性,不带前缀,

在我当前的project styles.xml中,我尝试定义:

<resources xmlns:ripple="http://schemas.android.com/apk/res-auto">
<resources xmlns:ripple="http://schemas.android.com/apk/res/com.gorkem.components">

样式与布局中的样式不匹配。在
styles.xml
中,删除自定义的
xmlns
声明,只需直接使用属性,不带前缀,如下所示:

<style name="FlatTextRipple">
    <item name="rv_centered">true</item>
    <item name="rv_color">#CCCCCC</item>
    <item name="rv_type">simpleRipple</item>
    <item name="rv_zoom">true</item>
    <item name="rv_zoomDuration">300</item>
</style>

真的
#中交
单纯形
真的
300

你用双“O”写的,我在这里写错了,这对我来说是正确的。API 23。
<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>
    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'.
<style name="FlatTextRipple">
    <item name="rv_centered">true</item>
    <item name="rv_color">#CCCCCC</item>
    <item name="rv_type">simpleRipple</item>
    <item name="rv_zoom">true</item>
    <item name="rv_zoomDuration">300</item>
</style>