【发布时间】:2015-07-18 06:00:40
【问题描述】:
我在activity_main.xml 文件的app: 行上收到“unbound prefix”的 XML 解析错误
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity"
app:rb_color="#0099CC"
>
...
rb_color 在res/values/attrs.xml 中定义如下:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="RippleBackground">
<attr name="rb_color" format="color" />
<attr name="rb_strokeWidth" format="dimension"/>
<attr name="rb_radius" format="dimension"/>
<attr name="rb_duration" format="integer"/>
<attr name="rb_rippleAmount" format="integer"/>
<attr name="rb_scale" format="float"/>
<attr name="rb_type" format="enum">
<enum name="fillRipple" value="0"/>
<enum name="strokeRipple" value="1"/>
</attr>
</declare-styleable>
</resources>
我正在遵循here 的指示。
但是由于波纹代码是作为单个 java 文件实现的,而不是将波纹代码构建为库然后将库合并到我的项目中,我只是将波纹源 java 文件直接放入我的项目中。
大概我需要将应用程序:更改为其他内容以引用rb_color 来设置它,但是该怎么做呢?
【问题讨论】: