简体   繁体   English

Android Studio用户可以选择颜色

[英]Android studio user can choose color

is there (androidstudio) any way to get color by user click on something like http://cdn.freshome.com/wp-content/uploads/2013/11/color-wheel.jpg ? 是否有(androidstudio)通过用户单击http://cdn.freshome.com/wp-content/uploads/2013/11/color-wheel.jpg之类的颜色来获取颜色的方法? It doesn't matter whether it be string,int or color. 不管是字符串,整数还是颜色都没有关系。

One way that i know it works is by duplicating an existent color res, for example: 我知道它起作用的一种方式是通过复制现有的颜色分辨率,例如:

<color name="window_background">#FFF5F5F5</color>

At the left of this line, there is a little square that displayed the color. 在此行的左侧,有一个小方块显示颜色。 Click on it and you can select another color. 单击它,您可以选择另一种颜色。 I don't know if there is other way of accomplish what you need. 我不知道是否还有其他方法可以满足您的需求。

EDIT: You asked for android studio, i answered accordingly. 编辑:您要求的android studio,我据此回答。 Based on your later comments the answer is NO. 根据您以后的评论,答案是否定的。 There is no default widget to do so (not that i know of). 没有默认的小部件可以这样做(我不知道)。 You would need to: 您需要:

a) Make a ColorPicker yourself a)自己制作一个ColorPicker

b) Use a library like this: https://github.com/LarsWerkman/HoloColorPicker b)使用像这样的库: https//github.com/LarsWerkman/HoloColorPicker

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM