2016-02-29 128 views
2

我使用下面库:https://github.com/lzyzsd/CircleProgress自定义布局XML绑定错误

我添加它到摇篮:

dependencies { 
    compile 'com.github.lzyzsd:circleprogress:[email protected]' 
} 

我把它添加到我的布局XML:

<?xml version="1.0" encoding="utf-8"?> 
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:orientation="vertical" > 

    <ScrollView 
     android:layout_width="fill_parent" 
     android:layout_height="fill_parent" 
     android:background="@color/bg_color" > 

     <LinearLayout 
      android:layout_width="fill_parent" 
      android:layout_height="wrap_content" 
      android:orientation="vertical" 
      android:paddingLeft="10dp" 
      android:paddingRight="10dp" > 

      <TextView 
       android:id="@+id/TextView01" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:layout_marginTop="10dp" 
       android:text="@string/minutes20" 
       android:textColor="@color/main_color" 
       android:textSize="22dp" 
       android:textStyle="bold" > 
      </TextView> 

      <TextView 
       android:id="@+id/TextView01" 
       android:layout_width="wrap_content" 
       android:layout_height="wrap_content" 
       android:text="@string/health_1" 
       android:textSize="16dp" 
       android:textStyle="bold" > 
      </TextView> 

      <FrameLayout 
       android:layout_width="fill_parent" 
       android:layout_height="fill_parent" 
       android:layout_gravity="center" 
       android:orientation="horizontal" > 

       <com.github.lzyzsd.circleprogress.CircleProgress 
        android:id="@+id/progressbar_1" 
        android:layout_marginLeft="50dp" 
        android:layout_width="100dp" 
        android:layout_height="100dp" 
        custom:circle_progress="20"/> 

我我得到一个错误:解析XML时出错:未绑定前缀

我想我不知怎么错过了定义nam协商?

+0

此行添加到您的XML'的xmlns:定制=“http://schemas.android.com/ apk/res-auto“' – NamNH

回答

4

我想你错过

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

root layout XML

添加引用take a look any demo file

+0

我应该在框架布局中添加这个吗? – tobias

+0

@tobias添加'root layout'。检查我的参考链接 –

+1

作品就像一个魅力。我已经尝试过这一行代码,但没有认识到“custom”是我需要的。 Thx – tobias