java Android PreferenceScreen“颜色选择器”实现

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14303378/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 15:48:56  来源:igfitidea点击:

Android PreferenceScreen "color picker" implementation

javaandroidlive-wallpaperpreferenceactivity

提问by Michal

can someone help me? I need implement some color picker to preference screen (live wallpaper settings). Is there any solution out there, some open source?

有人能帮我吗?我需要在首选项屏幕(动态壁纸设置)中实现一些颜色选择器。有没有解决方案,一些开源?

回答by Martin Stone

Too late for the original questioner I expect, but here's the library I wrote after not finding what I needed here. It can be used like this:

对于我期望的原始提问者来说为时已晚,但这是我在这里找不到所需内容后编写的库。它可以像这样使用:

<PreferenceScreen
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto">

    <com.rarepebble.colorpicker.ColorPreference
        android:key="myColor"
        android:title="@string/pref_title"
        android:defaultValue="#f00"
        />
</PreferenceScreen>

More info here:

更多信息在这里:

HSV-Alpha Color Picker for Android(GitHub).

适用于 Android 的 HSV-Alpha 颜色选择器(GitHub)。

HSV-Alpha Color Picker Demo(Google Play).

HSV-Alpha 颜色选择器演示(Google Play)。

I hope it's useful for somebody else.

我希望它对其他人有用。

ColorPreferenceColor Picker

颜色偏好颜色选择器

回答by Dixit Patel

I tried this one:

我试过这个:

  1. mColorPicker

  2. mColorPicker2

  1. 颜色选择器

  2. mColorPicker2

It is very easy to use. You can download the code and see an example.

这是非常容易使用。您可以下载代码并查看示例。

This is how it looks:

这是它的外观:

enter image description here

在此处输入图片说明

回答by Simone Pessotto

If someone is looking for a great new android color picker that use material design I have forked an great project from github and made a simple-to-use android color picker dialog.

如果有人正在寻找一个使用 Material Design 的很棒的新 android 颜色选择器,我已经从 github 中创建了一个很棒的项目,并制作了一个简单易用的 android 颜色选择器对话框。

This is the project: Android Color Picker

这是项目:Android 颜色选择器

Android Color Picker Example

Android 颜色选择器示例

It's easy to implement by yourself. There is a complete android studio project ready to download for see how it works.

自己实现很容易。有一个完整的 android studio 项目可供下载,看看它是如何工作的。

回答by MBH

you may check this:

你可以检查这个:

ColorPickerCollection

颜色选择器集合

If you want to let user choose on out of set of colors, you can use the ColorPickerCollection library.

如果你想让用户选择一组颜色,你可以使用 ColorPickerCollection 库。