Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Studio 3.0 - InflateException #55

Open
CarstenHouweling opened this issue Nov 3, 2017 · 2 comments
Open

Android Studio 3.0 - InflateException #55

CarstenHouweling opened this issue Nov 3, 2017 · 2 comments

Comments

@CarstenHouweling
Copy link

CarstenHouweling commented Nov 3, 2017

I recently updated my working project to Android Studio 3 with all the latest repository versions and i ran into an issue with your library:

android.view.InflateException: Binary XML file line #0: Binary XML file line #0: Error inflating class com.daimajia.numberprogressbar.NumberProgressBar Caused by: android.view.InflateException: Binary XML file line #0: Error inflating class com.daimajia.numberprogressbar.NumberProgressBar

Caused by: java.lang.UnsupportedOperationException: Can't convert value at index 2 to color: type=0x5 at android.content.res.TypedArray.getColor(TypedArray.java:473) at com.daimajia.numberprogressbar.NumberProgressBar.<init>(NumberProgressBar.java:185)

Line 185:
mUnreachedBarColor = attributes.getColor(R.styleable.NumberProgressBar_progress_unreached_color,default_unreached_color);

I use your library as followed:

<com.daimajia.numberprogressbar.NumberProgressBar
                android:id="@+id/progress"
                style="@style/NumberProgressBar_Custom"
                android:layout_alignParentBottom="true"
                android:visibility="gone" />
<style name="NumberProgressBar_Custom" parent="NumberProgressBar_Default">
        <item name="progress_reached_color">@color/colorPrimary</item>
        <item name="progress_reached_bar_height">5dp</item>
        <item name="progress_unreached_color">@android:color/transparent</item>
        <item name="progress_text_color">@color/colorPrimary</item>
        <item name="progress_text_size">5sp</item>
    </style>

Removing the progress_unreached_color item does not work.
Changing the unreached color to @color/white for example does not work.


After further investigation i notice i cannot add two of your styling items:
progress_text_color & progress_reached_bar_height

When i set the other styling parameters, it works fine:

<com.daimajia.numberprogressbar.NumberProgressBar
                android:id="@+id/progress"
                android:layout_height="wrap_content"
                android:layout_width="match_parent"
                bar:max="100"
                bar:progress="0"
                bar:progress_unreached_color="#ff0000" (@android:color/transparent also works)
                bar:progress_reached_color="#00ff00" (@color/colorPrimary also works)
                bar:progress_text_size="5sp"
                bar:progress_unreached_bar_height="0.75dp"
                android:layout_alignParentBottom="true"
                android:visibility="gone" />
@Yexiangxu
Copy link

me too, How to solve this problem

@RockyLin
Copy link

Actually, they've already fixed this bug in version 1.4, even though, you have to change a few attribute names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants
@CarstenHouweling @RockyLin @Yexiangxu and others