我正在尝试查找并导入 makeramen 库,因为我无法编译我的项目并收到这些错误:
错误信息:
Multiple annotations found at this line:
- error: No resource identifier found for attribute 'border_color' in package 'myapp'
- error: No resource identifier found for attribute 'mutate_background' in package 'myapp'
- error: No resource identifier found for attribute 'border_width' in package 'myapp'
- error: No resource identifier found for attribute 'oval' in package 'myapp'
我的 xml:
<com.makeramen.RoundedImageView xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/mapImage"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@drawable/list_map_bar"
android:padding="12dp"
android:scaleType="fitCenter"
android:src="@drawable/list_world"
app:border_color="@color/xroads_grey"
app:border_width="2dp"
app:mutate_background="true"
app:oval="true" />
我不知道如何解决这个问题并运行和编译 android 项目。 任何人都可以帮助我吗?
非常感谢!
更新 2
我收到了一个导入到 ADT 的 Android 项目 - Eclipse。缺少一些库,请检查下面的完整结构项目图片:
Android 项目(抱歉,我可以上传图片,因为 stackoverflow 不允许我上传任何图片):
LoginActivity
-Android 4.3
-Referenced Libraries
-rundedimageview-1.5.0-sources.jar
-src
-gen [Generated Java Files]
-assets
-bin
-libs
-res
-AndroidManifest.xml
-ic_launcher-we.png
-lint.xml
-project.properties
在文件夹/res/layout 下,我之前提到的关于此主题的文件有一些错误消息,因为缺少库和依赖项。因此,我已将 RoundedImageView JAR 添加到项目中,但没有任何变化。
有什么想法吗? 如果有人需要有关任何文件或错误消息的更多信息,请告诉我。 它缺少 build.gradle 文件,这是正常现象还是我该如何创建?
更新 3:
我按照 Nadeem Iqbal 的建议更改了代码,但错误仍然存在。我可以在代码中出现这些错误的情况下运行该应用程序。请帮忙!
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res/io.cran.crossroads"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<FrameLayout
android:layout_width="100dp"
android:layout_height="100dp"
android:id="@+id/map"
android:layout_alignBottom="@+id/avatar"
android:layout_toRightOf="@id/imageBarLeft">
<com.makeramen.RoundedImageView
android:id="@+id/mapImage"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@drawable/list_map_bar"
android:padding="12dp"
android:scaleType="fitCenter"
android:src="@drawable/list_world"
app:border_color="@color/xroads_grey"
app:border_width="2dp"
app:mutate_background="true"
app:oval="true" />
</FrameLayout>
最佳答案
在你的顶级 Root View 中添加这一行
xmlns:app="http://schemas.android.com/apk/res/YOUR.PACKAGE.NAME"
像这样:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res/YOUR.PACKAGE.NAME"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<com.makeramen.RoundedImageView
android:id="@+id/mapImage"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@drawable/list_map_bar"
android:padding="12dp"
android:scaleType="fitCenter"
android:src="@drawable/list_world"
app:border_color="@color/xroads_grey"
app:border_width="2dp"
app:mutate_background="true"
app:oval="true" />
</RelativeLayout>
关于java - 如何在 ADT Project for Eclipse 中导入库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27263015/