无法访问百分比相对布局



我想在win10下使用Ant在命令行项目中使用PercentRelativeLayout。我是Android新手,但有Java背景(作为程序员)。我也是蚂蚁的新手。

感谢您的帮助。查特

我已经使用 Android Tools 24.4.1 将 SDK Manager 更新到 Android 6.0 (API 23),并安装了 Android Support Lib 的 v23.2。

我有以下几点:

C:UserschattAppDataLocalAndroidsdk1extrasandroidsupportpercent

C:UserschattAppDataLocalAndroidsdk1extrasandroidsupportv14preferencelibs

严重错误是:在包"com"中找不到属性"layout_marginTopPercent"的资源标识符。查特顿.彼得.国际象棋时钟'

这是我在这里的第一篇文章,所以如果我能改进它,请告诉我。

再次感谢。

主.xml

<?xml version="1.0" encoding="utf-8"?>
<android.support.percent.PercentRelativeLayout
         xmlns:android="http://schemas.android.com/apk/res/android"
         xmlns:app="http://schemas.android.com/apk/res-auto"
         android:layout_width="match_parent"
         android:layout_height="match_parent">
<ImageView
          app:layout_marginTopPercent="25%"
          app:layout_marginLeftPercent="25%"
          app:layout_widthPercent="50%"
          app:layout_heightPercent="50%" />
</android.support.percent.PercentRelativeLayout>

编译结果:

D:AndroidChessClock>ant debug
Buildfile: D:AndroidChessClockbuild.xml
-set-mode-check:
-set-debug-files:
-check-env:
 [checkenv] Android SDK Tools Revision 24.4.1
 [checkenv] Installed at C:UserschattAppDataLocalAndroidsdk1
-setup:
     [echo] Project Name: ChessClock
  [gettype] Project Type: Application
-set-debug-mode:
-debug-obfuscation-check:
-pre-build:
-build-setup:
[getbuildtools] Using latest Build Tools: 21.1.2
     [echo] Resolving Build Target for ChessClock...
[gettarget] Project Target:   Google APIs
[gettarget] Vendor:           Google Inc.
[gettarget] Platform Version: 5.0.1
[gettarget] API level:        21
[gettarget] WARNING: No minSdkVersion value set. Application will install on all Android versions.
     [echo] ----------
     [echo] Creating output directories if needed...
    [mkdir] Created dir: D:AndroidChessClockbinrsObj
    [mkdir] Created dir: D:AndroidChessClockbinrsLibs
     [echo] ----------
     [echo] Resolving Dependencies for ChessClock...
[dependency] Library dependencies:
[dependency] No Libraries
[dependency]
[dependency] ------------------
     [echo] ----------
     [echo] Building Libraries with 'debug'...
   [subant] No sub-builds to iterate on
-code-gen:
[mergemanifest] Found Deleted Target File
[mergemanifest] Merging AndroidManifest files into one.
[mergemanifest] Manifest merger disabled. Using project manifest only.
     [echo] Handling aidl files...
     [aidl] No AIDL files to compile.
     [echo] ----------
     [echo] Handling RenderScript files...
     [echo] ----------
     [echo] Handling Resources...
     [aapt] Generating resource IDs...
     [aapt] D:AndroidChessClockreslayoutmain.xml:8: error: No resource identifier found for attribute 'layout_marginTopPercent' in package 'com.Chatterton.Peter.ChessClock'

不确定是否可以让它与蚂蚁一起工作。

您可以尝试切换到 Gradle,然后您需要将以下依赖项添加到 app build.gradle 文件中:

"编译'com.android.support:percent:23.1.2'"

最新更新