Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

A highly customizable color picker for Android

License

NotificationsYou must be signed in to change notification settings

jaredrummler/ColorPicker

Repository files navigation

APILicenseMaven Central

Yet another open source color picker for Android. So, why should you use this color picker? It is highly customizable and easy to use. You can simply add theColorPreference to your preferences and a beautiful color picker dialog will be displayed without additional code. The color picker supports alpha and allows you to set your own presets.

The original ColorPickerView was written byDaniel Nilsson.

Screenshots

GIF  Screenshot

Usage

Add theColorPreference to your preference XML:

<PreferenceScreenxmlns:android="http://schemas.android.com/apk/res/android"xmlns:app="http://schemas.android.com/apk/res-auto">  <PreferenceCategory>    <com.jaredrummler.android.colorpicker.ColorPreferenceandroid:defaultValue="@color/color_default"android:key="default_color"android:summary="@string/color_default_summary"android:title="@string/color_default_title"/>    ...  </PreferenceCategory></PreferenceScreen>

Note: Using AndroidX'sPreferenceFragmentCompat? Then usecom.jaredrummler.android.colorpicker.ColorPreferenceCompat

You can add attributes to customize theColorPreference:

nametypedocumentation
cpv_dialogTypeenum"custom" to show the color picker, "preset" to show pre-defined colors
cpv_showAlphaSliderbooleanShow a slider for changing the alpha of a color (adding transparency)
cpv_colorShapeenum"square" or "circle" for the shape of the color preview
cpv_colorPresetsreferenceAn int-array of pre-defined colors to show in the dialog
cpv_dialogTitlereferenceThe string resource id for the dialog title. By default the title is "Select a Color"
cpv_showColorShadesbooleantrue to show different shades of the selected color
cpv_allowPresetsbooleantrue to add a button to toggle to the custom color picker
cpv_allowCustombooleantrue to add a button to toggle to the presets color picker
cpv_showDialogbooleantrue to let the ColorPreference handle showing the dialog

You can also show aColorPickerDialog without using theColorPreference:

ColorPickerDialog.newBuilder().setColor(color).show(activity);

All the attributes above can also be applied to theColorPickerDialog. The activity that shows the dialogmustimplementColorPickerDialogListener to get a callback when a color is selected.

For further doumentation about how to use the library, check thedemo app included in this project.

Download

Downloadthe latest AAR or grab via Gradle:

implementation'com.jaredrummler:colorpicker:1.1.0'

License

Licensed under the Apache License, Version 2.0 (the "License");you may not use this file except in compliance with the License.You may obtain a copy of the License at   http://www.apache.org/licenses/LICENSE-2.0Unless required by applicable law or agreed to in writing, softwaredistributed under the License is distributed on an "AS IS" BASIS,WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.See the License for the specific language governing permissions andlimitations under the License.

Releases

No releases published

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp