betterpickers时间选择器的使用方法

1.配置android studio gradle 文件

 compile 'com.code-troopers.betterpickers:library:3.1.0'

2.在style 文件设置样式

 
  1. <style name="MyCustomBetterPickersDialogs" parent="BetterPickersRadialTimePickerDialog.PrimaryColor">

  2. <item name="bpPreHeaderBackgroundColor">@color/holo_red_dark</item>

  3. <item name="bpHeaderBackgroundColor">@color/holo_red_light</item>

  4. <item name="bpHeaderSelectedTextColor">@color/holo_orange_dark</item>

  5. <item name="bpHeaderUnselectedTextColor">@android:color/white</item>

  6.  
  7. <item name="bpBodyBackgroundColor">@color/holo_blue_dark</item>

  8. <item name="bpBodySelectedTextColor">@color/holo_orange_dark</item>

  9. <item name="bpBodyUnselectedTextColor">@android:color/white</item>

  10.  
  11. <item name="bpRadialBackgroundColor">@color/holo_orange_dark</item>

  12. <item name="bpRadialTextColor">@color/holo_purple</item>

  13. <item name="bpRadialPointerColor">@android:color/black</item>

  14.  
  15. <item name="bpButtonsBackgroundColor">@color/holo_green_dark</item>

  16. <item name="bpButtonsTextColor">@color/holo_orange_dark</item>

  17. </style>

3.color的使用

 
  1. <!-- A light Holo shade of blue -->

  2. <color name="holo_blue_light">#ff33b5e5</color>

  3. <!-- A light Holo shade of gray -->

  4. <color name="holo_gray_light">#33999999</color>

  5. <!-- A light Holo shade of green -->

  6. <color name="holo_green_light">#ff99cc00</color>

  7. <!-- A light Holo shade of red -->

  8. <color name="holo_red_light">#ffff4444</color>

  9. <!-- A dark Holo shade of blue -->

  10. <!-- A dark Holo shade of green -->

  11. <color name="holo_green_dark">#ff669900</color>

  12. <!-- A dark Holo shade of red -->

  13. <color name="holo_red_dark">#ffcc0000</color>

  14. <!-- A Holo shade of purple -->

  15. <color name="holo_purple">#ffaa66cc</color>

  16. <!-- A light Holo shade of orange -->

  17. <color name="holo_orange_light">#ffffbb33</color>

  18. <!-- A dark Holo shade of orange -->

  19. <color name="holo_orange_dark">#ffff8800</color>

  20. <!-- A really bright Holo shade of blue -->

  21. <color name="holo_blue_bright">#ff00ddff</color>

  22. <!-- A really bright Holo shade of gray -->

  23. <color name="holo_gray_bright">#33CCCCCC</color>

  24. <color name="holo_blue_dark">#ff0099cc</color>

4设置监听

CalendarDatePickerDialogFragment.OnDateSetListener

5使用方法

 
  1. CalendarDatePickerDialogFragment cdp = new CalendarDatePickerDialogFragment()

  2. .setOnDateSetListener(this);

  3. cdp.setThemeCustom(R.style.MyCustomBetterPickersDialogs);

  4. cdp.show(getSupportFragmentManager(), FRAG_TAG_DATE_PICKER);

发布了76 篇原创文章 · 获赞 21 · 访问量 11万+

猜你喜欢

转载自blog.csdn.net/u010227042/article/details/104283374