<kbd id="afajh"><form id="afajh"></form></kbd>
<strong id="afajh"><dl id="afajh"></dl></strong>
    <del id="afajh"><form id="afajh"></form></del>
        1. <th id="afajh"><progress id="afajh"></progress></th>
          <b id="afajh"><abbr id="afajh"></abbr></b>
          <th id="afajh"><progress id="afajh"></progress></th>

          ColorPickerAndroid 顏色選擇器

          聯(lián)合創(chuàng)作 · 2023-09-26 07:53

          ColorPicker

          一款標(biāo)準(zhǔn)的Android顏色選擇器,使用HSV和透明度選擇顏色。

          Gradle

          dependencies {
              implementation 'com.github.duanhong169:colorpicker:${latestVersion}'
              ...
          }

          ${latestVersion}請?zhí)鎿Q為當(dāng)前最新版本號(hào),見 releases.

          Usage

          使用 ColorPickerPopup

          new ColorPickerPopup.Builder(this)
                  .initialColor(Color.RED) // Set initial color
                  .enableAlpha(true) // Enable alpha slider or not
                  .okTitle("Choose")
                  .cancelTitle("Cancel")
                  .showIndicator(true)
                  .showValue(true)
                  .build()
                  .show(v, new ColorPickerPopup.ColorPickerObserver() {
                      @Override
                      public void onColorPicked(int color) {
                          v.setBackgroundColor(color);
                      }
          
                      @Override
                      public void onColor(int color, boolean fromUser) {
          
                      }
                  });

          使用 ColorPickerView

          • 將 ColorPickerView 添加到 layout xml :

          <top.defaults.view.ColorPickerView
              android:id="@+id/colorPicker"
              android:layout_width="0dp"
              android:layout_height="wrap_content"
              app:enableAlpha="true"
              app:layout_constraintLeft_toLeftOf="parent"
              app:layout_constraintRight_toRightOf="parent"
              app:layout_constraintTop_toTopOf="parent"/>

          查閱 top_defaults_view_color_picker_attrs.xml 了解所有支持的屬性。

          • 執(zhí)行 ColorObserver 并訂閱 ColorPickerView 以從 ColorPickerView 接收顏色更新:

          colorPickerView.subscribe((color, fromUser) -> {
              // use the color
          });

          • 設(shè)置初始顏色:

          colorPickerView.setInitialColor(0x7F313C93);

          • 重置初始顏色:

          colorPickerView.reset();

          更詳細(xì)的使用方法請參見示例。

          瀏覽 10
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          評論
          圖片
          表情
          推薦
          點(diǎn)贊
          評論
          收藏
          分享

          手機(jī)掃一掃分享

          編輯 分享
          舉報(bào)
          <kbd id="afajh"><form id="afajh"></form></kbd>
          <strong id="afajh"><dl id="afajh"></dl></strong>
            <del id="afajh"><form id="afajh"></form></del>
                1. <th id="afajh"><progress id="afajh"></progress></th>
                  <b id="afajh"><abbr id="afajh"></abbr></b>
                  <th id="afajh"><progress id="afajh"></progress></th>
                  91人妻无码成人精品一区二区三区 | 女人20岁毛片60分钟 | 伊人色色大香蕉 | 欧美精品免费在线观看 | 免费 无码 高清 |