Multi-ColorPicker

介绍:

一个强大的颜色选择控件。

运行效果:

使用说明:

build.gradle

repositories {
  mavenCentral() // or jcenter() works as well
}
dependencies {
  compile 'com.github.skydoves:multicolorpicker:1.0.5'
}

or Maven

<dependency>
  <groupId>com.github.skydoves</groupId>
  <artifactId>multicolorpicker</artifactId>
  <version>1.0.5</version>
</dependency>

xml

<com.skydoves.multicolorpicker.MultiColorPickerView
        android:id="@+id/multiColorPickerView"
        android:layout_width="300dp"
        android:layout_height="300dp"
        app:palette="@drawable/palette"/>

Attribute in xml

app:palette="@drawable/palette" // set palette image

get Colors from Listener

multiColorPickerView.addSelector(selectorDrawable, new ColorListener() {
            @Override
            public void onColorSelected(ColorEnvelope envelope) {
                int color = envelope.getColor();
                int\[\] rgb = envelope.getRgb();
                String htmlCode = envelope.getHtmlCode();
                // TODO
            }
        });

MultiColorPickerView Methods

MethodsReturnDescription
addSelector(Drawable drawable, ColorListener listener)Selectoradds a Selector and returning it
setPaletteDrawable(Drawable drawable)voidchanges palette's drawable
getMixedColor(Float ratio(0~1))voidreturns mixed color from selectors seleted color
setSelectedAlpha(Float ratio(0~1)voidsets active selector's alpha
getSelectorsSize()intreturns selectors size
setFlagView(FlagView flagView)voidsets a FlagView on colorpicker
setFlagMode(FlagMode flagmode)voidsets FlagMode(Always, Last, None)
setFlagFlipable(boolean flipable)voidsets flag's flip-able when flag go over top boundary

Selector Methods

MethodsReturnDescription
getX()intreturns selector's X axis
getY()intreturns selector's Y axis
getColor()intreturns the selector's selected color
getColorHtml()Stringreturns the selector's selected color html code
getColorRGB()int[3]returns the selector's selected color rgb array
onMove(int x, int y)voidmoves the selector's point
onMoveCenter()voidmoves the selector's point to center
onSelect()voidselects point at selector's position (used with onMove())
onSelect(int x, int y)voidmoves and selects point
已下载
0