HoloColorPicker实现圆环形颜色选择器,可以改变颜色饱和度来选择颜色。选择颜色时,可以用手指沿着圆环滑动一个滑块,从而选择颜色。

添加以下XML至你的布局中:

1
2
3
4
<com.larswerkman.holocolorpicker.ColorPicker
    android:id="@+id/picker"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

To add a Saturation/Value bar to your layout add this to your xml

1
2
3
4
<com.larswerkman.holocolorpicker.SVBar
    android:id="@+id/svbar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

The same goes for the Opacity bar

1
2
3
4
<com.larswerkman.holocolorpicker.OpacityBar
    android:id="@+id/opacitybar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

Saturation bar

1
2
3
4
<com.larswerkman.holocolorpicker.SaturationBar
    android:id="@+id/saturationbar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

and a Value bar

1
2
3
4
<com.larswerkman.holocolorpicker.ValueBar
    android:id="@+id/valuebar"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"/>

To connect the bars with the colorpicker and to get the selected color.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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);
 
//To get the color
picker.getColor();
 
//To set the old selected color u can do it like this
picker.setOldCenterColor(picker.getColor());
// adds listener to the colorpicker which is implemented
//in the activity
picker.setOnColorChangedListener(this);

项目主页:http://www.open-open.com/lib/view/home/1389353422164

最新文章

  1. remote debug in visual studio
  2. php模式设计之 注册树模式
  3. xampp版本和具体的php,mysql版本的对应
  4. DWR3.0框架入门(2) —— DWR的服务器推送
  5. SpringMVC中的session用法及细节记录
  6. Out of mind - 魔术纸
  7. 《高性能MySQL(第3版)》【PDF】下载
  8. 第三篇:Python字符编码
  9. UOJ #236. 【IOI2016】railroad
  10. Python----支持向量机SVM
  11. C++模板、.vimrc和一些Linux配置
  12. Day2----Python学习之路笔记(2)
  13. mongodb+nodejs
  14. JS实现选择菜单栏(配合慕课网淘宝搜索框的课程)
  15. Spatis service单元测试: 使用mock mapper的方式
  16. Java:多线程,CountDownLatch同步器
  17. Oracle批量执行SQL语句
  18. POI解析Excel文件
  19. Andorid- 反序列化,采用pull解析 xml 文件
  20. HDU - 2604 矩阵快速幂 字符串递推 两种解法

热门文章

  1. 「Foundation」字符串
  2. 第三章 视图和URL配置
  3. 资源文件(.RES)的应用
  4. java学习之xml
  5. android面试题之三
  6. node.js第十课(HTTPserver)
  7. DFS 练习 (这篇真的是随笔)
  8. SQLite3的使用(用到了dll)good
  9. Qt学习:线程间共享数据(使用信号槽传递数据,必须提前使用qRegisterMetaType来注册参数的类型)
  10. 怎样为ubuntu eclipse 添加 GBK字符集