簡體   English   中英

無法訪問PercentRelativeLayout

[英]Can't access PercentRelativeLayout

我想在win10下使用Ant的命令行項目中使用PercentRelativeLayout。 我是Android的新手,但具有Java背景(作為程序員)。 我也是螞蟻的新手。

謝謝你的幫助。 chatt

我已使用Android工具24.4.1將SDK Manager更新為Android 6.0(API 23),並安裝了Android支持庫v23.2。

我有以下幾點:

C:\Users\chatt\AppData\Local\Android\sdk1\extras\android\support\percent

C:\Users\chatt\AppData\Local\Android\sdk1\extras\android\support\v14\preference\libs

嚴重錯誤是:在包'com.Chatterton.Peter.ChessClock'中找不到屬性'layout_marginTopPercent'的資源標識符

這是我在這里的第一篇文章,因此,如果我可以改進的話,請告訴我。

再次感謝。

main.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:\Android\ChessClock>ant debug
Buildfile: D:\Android\ChessClock\build.xml
-set-mode-check:
-set-debug-files:
-check-env:
 [checkenv] Android SDK Tools Revision 24.4.1
 [checkenv] Installed at C:\Users\chatt\AppData\Local\Android\sdk1
-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:\Android\ChessClock\bin\rsObj
    [mkdir] Created dir: D:\Android\ChessClock\bin\rsLibs
     [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:\Android\ChessClock\res\layout\main.xml:8: error: No resource identifier found for attribute 'layout_marginTopPercent' in package 'com.Chatterton.Peter.ChessClock'

不知道是否可以與ant一起使用。

您可以嘗試切換到Gradle,然后需要將以下依賴項添加到應用程序build.gradle文件中:

“編譯'com.android.support:percent:23.1.2'”

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM