colorpicker
colorpicker copied to clipboard
Add a listener of slider?
Is it possible to add the listener for sliders? And we can get the final selected color without one more click on color hue
If you use layout xml, you can add listener when value changed like
final AlphaSlider alphaSlider = (AlphaSlider) rootView.findViewById(R.id.v_alpha_slider);
alphaSlider.setOnValueChangedListener(new OnValueChangedListener() {
@Override
public void onValueChanged(float value) {
// do something
}
})
or if you using version 0.0.13
and dialog builder, you can add color changed listener like this
//
ColorPickerDialogBuilder.with(context)
.setOnColorChangedListener(new OnColorChangedListener() {
@Override
public void onColorChanged(int selectedColor) {
// Handle on color change
Log.d("ColorPicker", "onColorChanged: 0x" + Integer.toHexString(selectedColor));
}
})
I got the build error with v0.0.13
C:\work\android\app\build\intermediates\res\merged\debug\values-v24\values-v24.xml Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'. Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'. Error:(3) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Borderless.Colored'. Error:(4) Error retrieving parent for item: No resource found that matches the given name 'android:TextAppearance.Material.Widget.Button.Colored'.
my config:
compileSdkVersion 23 buildToolsVersion "23.0.3" defaultConfig { minSdkVersion 21 targetSdkVersion 23
v0.0.12 works fine. May I have your help?
I think android buildtool version is too old.
Could you update compileSdkVersion 25
and targetSdkVersion 25
in app's build.gradle
and
update classpath 'com.android.tools.build:gradle:2.3.0-beta3'
in project's build.gradle
?
I think This error relate to compile 'com.android.support:appcompat-v7:25.1.1'
.
Thanks ! It works! But I have an issue: There is a similar debounce principle in OnColorSelectedListener(), but not in OnColorChangedListener(). Thus it makes too many events when sliding in hue or slider with OnColorChangedListener(). Is there a good way to avoid this?
Thanks much again!
#34 should be implement to do that