2016-06-13 3 views
6

저는 Android Dev에 처음으로 익숙하며 오픈 소스/타사 확장/플러그인을 통합하는 방법을 이해하려고합니다. 현재 내 Gradle을 보이는Android : 사용자 정의 XML을 얻는 방법

compile 'com.github.silvestrpredko:dot-progress-bar:[email protected]' 

:

나는 다음과 같은 Gradle을 종속성을 추가하도록 지시 https://github.com/silvestrpredko/DotProgressBarExample/tree/master/app

에서 Gradle을 방법에 추가, 가장 최근에 라이브러리를 통해 두 개의 서로 다른 패키지를 포함하도록 시도했다 like :

apply plugin: 'com.android.application' 

android { 
    compileSdkVersion 23 
    buildToolsVersion "23.0.3" 

    defaultConfig { 
     applicationId "com.e.crispens.tuna" 
     minSdkVersion 16 
     targetSdkVersion 23 
     versionCode 1 
     versionName "1.0" 
    } 
    buildTypes { 
     release { 
      minifyEnabled false 
      proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' 
     } 
    } 
} 

repositories { 
    jcenter() 
} 

dependencies { 
    compile fileTree(dir: 'libs', include: ['*.jar']) 
    testCompile 'junit:junit:4.12' 

    compile 'com.android.support:appcompat-v7:23.4.0' 
    compile 'com.android.support:support-v4:23.4.0' 
    compile 'com.github.silvestrpredko:dot-progress-bar:[email protected]' 
} 

그리고 docs에 따라 다음 XML로 레이아웃을 만들었습니다 (관련 당사자는 do CS) :

/Users/crispensmith/AndroidStudioProjects/Tuna/app/src/main/res/layout/fragment_string.xml 
Error:(7) Error parsing XML: unbound prefix 
Error:Execution failed for task ':app:processDebugResources'. 
> com.android.ide.common.process.ProcessException: org.gradle.process.internal.ExecException: Process 'command '/Users/crispensmith/Library/Android/sdk/build-tools/23.0.3/aapt'' finished with non-zero exit value 1 

사용자 정의 XML을 사용하여 이러한 패키지를 통합하는 올바른 방법은 무엇입니까 :

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.e.crispens.tuna.StringFragment"> 

    <com.github.silvestrpredko.dotprogressbar.DotProgressBar 
     android:id="@+id/dot_progress_bar" 
     android:layout_width="match_parent" 
     android:layout_height="50dp" 
     custom:amount="5" 
     custom:duration="@android:integer/config_mediumAnimTime" 
     custom:endColor="@color/light_blue_A400" 
     custom:startColor="@color/light_blue_A700"/> 


</FrameLayout> 

그러나,이 오류 받고 있어요?

+0

'정의를 추가하여 : amount', 예를 들어,'custom'은 "unbound prefix"입니다. –

+0

그래, 알았어. 그러나 플러그인 Github 페이지에 따르면 build.gradle 파일에 종속성을 포함시켜 해결해야합니다. –

+0

Github 프로젝트의 경우 문서화 된대로 작동하지 않는 경우 응용 프로그램 예제 소스 코드 –

답변

3

당신은 custom 네임 스페이스의 선언을 놓치고, 당신이 그것을 정의 할 수 있습니다 FrameLayout이에이 속성

xmlns:custom="http://schemas.android.com/apk/res-auto" 
1

XML에 custom 네임 스페이스를 정의해야합니다. 샘플 코드 here을 살펴보십시오. 이 샘플에서는 사용자 정의 네임 스페이스가 선언되었음을 알 수 있습니다. 이 같은도 선언해야합니다

<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:custom="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    tools:context="com.e.crispens.tuna.StringFragment"> 

    <com.github.silvestrpredko.dotprogressbar.DotProgressBar 
     android:id="@+id/dot_progress_bar" 
     android:layout_width="match_parent" 
     android:layout_height="50dp" 
     custom:amount="5" 
     custom:duration="@android:integer/config_mediumAnimTime" 
     custom:endColor="@color/light_blue_A400" 
     custom:startColor="@color/light_blue_A700"/> 

</FrameLayout> 
+0

문제와 해결 방법을 설명하고 철저한 코드 예제를 제공하기 때문에이 내용을 동의합니다. 많은 감사합니다. –

관련 문제