ColorPicker picker = (ColorPicker) findViewById(R.id.picker);
SVBar svBar = (SVBar) findViewById(R.id.svbar);
OpacityBar opacityBar = (OpacityBar) findViewById(R.id.opacitybar);
SaturationBar saturationBar = (SaturationBar) findViewById(R.id.saturationbar);
ValueBar valueBar = (ValueBar) findViewById(R.id.valuebar);
picker.addSVBar(svBar);
picker.addOpacityBar(opacityBar);
picker.addSaturationBar(saturationBar);
picker.addValueBar(valueBar);
//获取颜色
picker.getColor();
//设置旧的选中的颜色
picker.setOldCenterColor(picker.getColor());
// 设置color改变事件监听器
picker.setOnColorChangedListener(this);
//取消显示旧颜色
picker.setShowOldCenterColor(false);
<com.larswerkman.holocolorpicker.ColorPicker
android:id="@+id/picker"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
dependencies {
compile 'com.larswerkman:HoloColorPicker:1.5'//引入依赖
}