2017-10-10 15 views
0

私はAndroid Studioとjavaで初めてのアプリケーションを作成しています。 プロジェクトにゲージを追加したいのですが、 "sc-gauges"(Github)というライブラリが見つかりました。 私はbuild.gradleにmavenリポジトリと依存関係を追加しました。私は外部ライブラリでsc-gauges-2.6.4を見ることができます。私はgithubのページから例を追加しました:XMLを解析中にエラーが発生しました:アンバインドプレフィックス(外部ライブラリ)

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout 
xmlns:android="http://schemas.android.com/apk/res/android" 
xmlns:tools="http://schemas.android.com/tools" 
xmlns:app="http://schemas.android.com/apk/res-auto" 
android:layout_width="match_parent" 
android:layout_height="match_parent" 
app:layout_behavior="@string/appbar_scrolling_view_behavior" 
tools:showIn="@layout/activity_main" 
tools:context="com.example.gauge.gauge.MainActivity"> 

<com.sccomponents.gauges.ScArcGauge 
    android:layout_width="300dp" 
    android:layout_height="wrap_content" 
    android:padding="30dp" 
    android:background="#f5f5f5" 
    sc:angleStart="135" 
    sc:angleSweep="270" 
    sc:strokeSize="6dp" 
    sc:progressSize="4dp" 
    sc:value="45" 
    sc:notches="8" 
    sc:notchesLength="10dp" 
    sc:textTokens="01|02|03|04|05|06|07|08" 
    sc:pointerRadius="10dp" 
    /> 

</android.support.constraint.ConstraintLayout> 

com.sccomponents.gauges.ScArcGaugeは、SCのためではなく動作します:私はエラーを取得する接頭辞:エラー:バインドされていない接頭辞:XMLをパース(12)エラー。私は簡単な修正があるように感じるが、私はJavaプログラミングとAndroid Studioには全く新しいので、私はそれを見つけることができていない。

+0

は接頭語のように見える「SC:」他の人がしているように、たとえば...トップレイアウトにインポートされていません。 'xml:android'は以下のようにインポートされ、問題なく使用されます。その制約のレイアウトにそのsccomponentsのものを含める方法を確認してください... – deHaar

+0

私はそれを見ていたが、私はそれを見つけることができませんでした。 – Ingmar05

+0

@ W0rmH0leは正しい答えを...自動リソースの包含 – deHaar

答えて

1

あなたのxmlファイルにこれを追加します。

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

終わり:

<?xml version="1.0" encoding="utf-8"?> 
<android.support.constraint.ConstraintLayout 
    xmlns:android="http://schemas.android.com/apk/res/android" 
    xmlns:tools="http://schemas.android.com/tools" 
    xmlns:app="http://schemas.android.com/apk/res-auto" 
    xmlns:sc="http://schemas.android.com/apk/res-auto" 
    android:layout_width="match_parent" 
    android:layout_height="match_parent" 
    app:layout_behavior="@string/appbar_scrolling_view_behavior" 
    tools:showIn="@layout/activity_main" 
    tools:context="com.example.gauge.gauge.MainActivity"> 
関連する問題