android - 使用 Android 库项目时构建错误

标签 android library-project

我正在尝试在 github 上使用这个库项目:

https://github.com/pakerfeldt/android-viewflow

这个 Android 库项目提供水平滑动。

我将解释我是如何尝试使用这个库的:

  1. 我从 github 下载了这个项目,并将“viewflow”项目和“现有项目导入工作区”一起导入。 (Eclipse 给出了一些错误,但我修复了它们。这不是问题所在。)
  2. 我创建了一个名为“test”的新 android 项目。
  3. 我将 viewflow 项目添加到我的测试项目的构建路径中。 (使用 Java 构建路径->项目->添加)
  4. 这是我的 main.xml:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res/com.example.test"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/header_layout"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:gravity="center_horizontal"
        android:orientation="vertical" >

        <org.taptwo.android.widget.TitleFlowIndicator
            android:id="@+id/viewflowindic"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_marginTop="10dip"
            app:clipPadding="5dp"
            app:footerColor="#FFFFC445"
            app:footerLineHeight="2dp"
            app:footerTriangleHeight="10dp"
            app:selectedColor="#FFFFC445"
            app:selectedSize="12dp"
            app:textColor="#FFFFFFFF"
            app:textSize="11dp"
            app:titlePadding="10dp" >
        </org.taptwo.android.widget.TitleFlowIndicator>
    </LinearLayout>

    <org.taptwo.android.widget.ViewFlow
        android:id="@+id/viewflow"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:duplicateParentState="true" >
    </org.taptwo.android.widget.ViewFlow>
</LinearLayout>

但是 Eclipse 给出了这些错误:

Description Resource    Path    Location    Type
R cannot be resolved to a variable  Main.java   /test/src/com/example/test  line 14 Java Problem
R cannot be resolved to a variable  Main.java   /test/src/com/example/test  line 19 Java Problem
error: No resource identifier found for attribute 'titlePadding' in package 'com.example.test'  main.xml    /test/res/layout    line 15 Android AAPT Problem
error: No resource identifier found for attribute 'textSize' in package 'com.example.test'  main.xml    /test/res/layout    line 15 Android AAPT Problem
error: No resource identifier found for attribute 'textColor' in package 'com.example.test' main.xml    /test/res/layout    line 15 Android AAPT Problem
error: No resource identifier found for attribute 'selectedSize' in package 'com.example.test'  main.xml    /test/res/layout    line 15 Android AAPT Problem
error: No resource identifier found for attribute 'selectedColor' in package 'com.example.test' main.xml    /test/res/layout    line 15 Android AAPT Problem
error: No resource identifier found for attribute 'clipPadding' in package 'com.example.test'   main.xml    /test/res/layout    line 15 Android AAPT Problem
error: No resource identifier found for attribute 'footerColor' in package 'com.example.test'   main.xml    /test/res/layout    line 15 Android AAPT Problem
error: No resource identifier found for attribute 'footerLineHeight' in package 'com.example.test'  main.xml    /test/res/layout    line 15 Android AAPT Problem
error: No resource identifier found for attribute 'footerTriangleHeight' in package 'com.example.test'  main.xml    /test/res/layout    line 15 Android AAPT Problem

我导入了它的示例项目(https://github.com/pakerfeldt/android-viewflow/tree/master/viewflow-example),它工作正常!

问题可能与命名空间有关,但我无法解决这个问题。

最佳答案

app:selectedSize="12dp"删除这一行

关于android - 使用 Android 库项目时构建错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11391982/

相关文章:

android - 如何使此方法通用?将 RelativeLayout 转换为位图图像

android - android中的布局管理

android - 使用库项目和 android.view.InflateException 二进制 XML 文件行 #7 错误膨胀类

android - 从 Android-Library-Project 启动 Activity

android - 将 "NoSuchMethodException"和 "android.graphics.FontFamily"更新为 30 时,类 "targetSdkVersion"出现 "compileSdkVersion"错误

android - 在 finish() 之后,发布到 Activity 的 Handler 的 Runnables 将继续执行多长时间?

Android EditText MultiLine 与句子大写

android - 错误 :(2, 0) 未找到 ID 为 'android-test' 的插件

android - 库已添加 : Gradle Build