无法将true转换为drawable

时间:2015-02-06 23:43:30

标签: android android-studio

我在Android Studio上导入了Circle Layout library。当我尝试在activity_main.xml中插入此代码时:

<ru.biovamp.widget.CircleLayout
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    app:angleOffset="90.0">

    <!-- Add here any views you want -->

</ru.biovamp.widget.CircleLayout>

我收到此错误:

Failed to convert true into a drawable java.lang.NumberFormatException: Color value 'true' must start with #   at com.android.layoutlib.bridge.impl.ResourceHelper.getColor(ResourceHelper.java:73)   at com.android.layoutlib.bridge.impl.ResourceHelper.getDrawable(ResourceHelper.java:264)   at android.content.res.BridgeTypedArray.getDrawable(BridgeTypedArray.java:674)   at ru.biovamp.widget.CircleLayout.<init>(CircleLayout.java:93)   at java.lang.reflect.Constructor.newInstance(Constructor.java:408)   at android.view.LayoutInflater.rInflate_Original(LayoutInflater.java:806)   at android.view.LayoutInflater_Delegate.rInflate(LayoutInflater_Delegate.java:64)   at android.view.LayoutInflater.rInflate(LayoutInflater.java:782)   at android.view.LayoutInflater.inflate(LayoutInflater.java:504)   at android.view.LayoutInflater.inflate(LayoutInflater.java:385) 

为了解决这个问题,我该怎么办?另外,我可以在这里发布哪些其他代码以帮助解决问题?

完整的activity_main.xml:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent" android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" tools:context=".MainActivity">



<ru.biovamp.widget.CircleLayout
    android:layout_width="wrap_content"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    app:angleOffset="90.0">

    <!-- Add here any views you want -->
    <View android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:text="ok"/>

</ru.biovamp.widget.CircleLayout>
</RelativeLayout>

2 个答案:

答案 0 :(得分:0)

你试过吗

<ru.biovamp.widget.CircleLayout
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:background="@android:color/white"
app:angleOffset="90.0" />

答案 1 :(得分:0)

对我来说,Android Studio将drawable放在了错误的目录中。确保它位于正确的资源目录中。