Dhaval2404 / ColorPicker

🎨 Color Picker Library for Android
Apache License 2.0
277 stars 39 forks source link

Error using ColorPicker #5

Closed Javierenrique00 closed 4 years ago

Javierenrique00 commented 4 years ago

Hello I was trying to use the ColorPicker, but when the app is running and the Dialog is opening the app crash with the following error:

E/AndroidRuntime: FATAL EXCEPTION: main Process: xxxx.xxxxxx.xxxx.xxxx, PID: 4848 android.view.InflateException: Binary XML file line #20: Binary XML file line #20: Error inflating class com.google.android.material.card.MaterialCardView Caused by: android.view.InflateException: Binary XML file line #20: Error inflating class com.google.android.material.card.MaterialCardView Caused by: java.lang.reflect.InvocationTargetException at java.lang.reflect.Constructor.newInstance0(Native Method) at java.lang.reflect.Constructor.newInstance(Constructor.java:343) at android.view.LayoutInflater.createView(LayoutInflater.java:647) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:790) at android.view.LayoutInflater.createViewFromTag(LayoutInflater.java:730) at android.view.LayoutInflater.rInflate(LayoutInflater.java:863) at android.view.LayoutInflater.rInflateChildren(LayoutInflater.java:824) at android.view.LayoutInflater.inflate(LayoutInflater.java:515) at android.view.LayoutInflater.inflate(LayoutInflater.java:423) at android.view.LayoutInflater.inflate(LayoutInflater.java:374) at com.github.dhaval2404.colorpicker.ColorPickerDialog.show(ColorPickerDialog.kt:202) at com.github.dhaval2404.colorpicker.ColorPickerDialog$Builder.show(ColorPickerDialog.kt:186) at com.mundocrativo.javier.twitter.ui.design.DesignFragment.showColorPicker(DesignFragment.kt:47) at com.mundocrativo.javier.twitter.ui.design.DesignFragment$onCreateView$1.onClick(DesignFragment.kt:25)

It looks that there are a dependency that is not compatible. I´m opening a newproject in android studio and the only dependency that I use is this color picker.

I´m using Android Studio 3.5.

This is the dependencies in the gradle file:

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
    implementation 'androidx.appcompat:appcompat:1.1.0'
    implementation 'androidx.core:core-ktx:1.2.0'
    implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
    implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
    implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'

    implementation 'com.github.dhaval2404:colorpicker:1.1'

    testImplementation 'junit:junit:4.12'
    androidTestImplementation 'androidx.test:runner:1.2.0'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
}
marcauberer commented 4 years ago

Oh. This issue sounds familiar to me ... You can try to use a theme for your activity, inheriting from Theme.MaterialComponents e.g.: Theme.MaterialComponents.DayNight.NoActionBar. This should help

marcauberer commented 4 years ago

And try to add this dependency: implementation 'com.google.android.material:material:1.1.0'

Javierenrique00 commented 4 years ago

Hello Marc, It worked Ok, with the Theme.MaterialComponents.DayNight.NoActionBar and the  implementation 'com.google.android.material:material:1.1.0' I'm making test for the color picker to see if I use it in my app.

Thanks for your quick response. Javier E. Ramírez

On Tuesday, April 14, 2020, 04:13:42 PM GMT-5, Marc Auberer <notifications@github.com> wrote:  

And try to add this dependency: implementation 'com.google.android.material:material:1.1.0'

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.

Javierenrique00 commented 4 years ago

I close the issue, but I think that in the documentation is necessary to take into account the components needed.

Maulikpatel2492 commented 3 years ago

https://github.com/duanhong169/ColorPicker/issues/7#issuecomment-428801006

is solved

Thanks

Maulikpatel2492 commented 3 years ago

How to set default progress bar CENTER on ANDROID programmatically

final ProgressDialog progressDialog = new ProgressDialog(context); progressDialog.setIndeterminate(true); try { progressDialog.setIndeterminateDrawable(context.getResources().getDrawable(R.drawable.without_mask_logo, null)); progressDialog.show(); RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(100,100); } catch (Exception e) { e.printStackTrace(); }

iqtoon commented 2 years ago

i have the same issue i tried to change theme to "Theme.MaterialComponents.DayNight.NoActionBar" and "implementation 'com.google.android.material:material:1.1.0'" and nothing still not working :(

iqtoon commented 2 years ago

i have the same issue i tried to change theme to "Theme.MaterialComponents.DayNight.NoActionBar" and "implementation 'com.google.android.material:material:1.1.0'" and nothing still not working :(