Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/310.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/207.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在Eclipse的ADT项目中导入库_Java_Android_Eclipse_Libraries - Fatal编程技术网

Java 如何在Eclipse的ADT项目中导入库

Java 如何在Eclipse的ADT项目中导入库,java,android,eclipse,libraries,Java,Android,Eclipse,Libraries,我正在尝试查找并导入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_backgrou

我正在尝试查找并导入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" />
在/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>

您似乎可以在此处找到库的源代码:


下载它并尝试在Eclipse中导入roundedImageView文件夹。将此项目设置为库(项目>属性>Android),然后转到您自己的项目并添加库(项目>属性>Android>添加)。

在顶部根视图中添加此行

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>

您缺少属性值。 这些应该已经存在于库项目中。 尝试从头开始重新导入库

 <?xml version="1.0" encoding="utf-8"?>
<resources>
  <declare-styleable name="RoundedImageView">
    <attr name="corner_radius" format="dimension" />
    <attr name="border_width" format="dimension" />
    <attr name="border_color" format="color" />
    <attr name="mutate_background" format="boolean" />
    <attr name="oval" format="boolean" />
    <attr name="android:scaleType" />
  </declare-styleable>
</resources>


以防万一

由于XML名称空间问题,您会遇到这些错误。在xml中,
xmlns:app=”http://schemas.android.com/apk/res-auto“
应更改为

xmlns:app=”http://schemas.android.com/apk/lib/com.makeramen.roundedimageview“

注-

/res改为/lib

另外,将包名
com.makeramen.RoundedImageView
更改为

com.makeramen.roundedimageview.roundedimageview

试试这个:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/lib/com.makeramen.roundedimageview"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${relativePackage}.${activityClass}" >

<com.makeramen.roundedimageview.RoundedImageView
    android:id="@+id/avatar"
    android:layout_width="55dip"
    android:layout_height="55dp"
    android:layout_centerInParent="true"
    android:scaleType="centerCrop"
    android:src="@drawable/daimajia"
    app:border_color="#ffffff"
    app:border_width="1dp"
    app:corner_radius="10dip"
    app:mutate_background="true"
    app:oval="true" />

</RelativeLayout>


希望这能解决您的问题。

您使用的是Eclipse IDE还是Android Studio?我使用的是ADT-Eclipse。ADT不允许我从Project>Properties>Android添加库,所以我在我的项目中的引用库下手动添加了库。但是没有任何改变,我会更新这个问题,这样我就可以看到了
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/lib/com.makeramen.roundedimageview"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="${relativePackage}.${activityClass}" >

<com.makeramen.roundedimageview.RoundedImageView
    android:id="@+id/avatar"
    android:layout_width="55dip"
    android:layout_height="55dp"
    android:layout_centerInParent="true"
    android:scaleType="centerCrop"
    android:src="@drawable/daimajia"
    app:border_color="#ffffff"
    app:border_width="1dp"
    app:corner_radius="10dip"
    app:mutate_background="true"
    app:oval="true" />

</RelativeLayout>