Example #1
0
  /** 联动WheelView */
  private void initWheel1() {
    mainWheelView = (WheelView) findViewById(R.id.main_wheelview);
    mainWheelView.setWheelAdapter(new ArrayWheelAdapter(this));
    mainWheelView.setSkin(WheelView.Skin.Holo);
    mainWheelView.setWheelData(createMainDatas());
    WheelView.WheelViewStyle style = new WheelView.WheelViewStyle();
    style.selectedTextSize = 20;
    style.textSize = 16;
    mainWheelView.setStyle(style);

    subWheelView = (WheelView) findViewById(R.id.sub_wheelview);
    subWheelView.setWheelAdapter(new ArrayWheelAdapter(this));
    subWheelView.setSkin(WheelView.Skin.Holo);
    subWheelView.setWheelData(
        createSubDatas().get(createMainDatas().get(mainWheelView.getSelection())));
    subWheelView.setStyle(style);
    mainWheelView.join(subWheelView);
    mainWheelView.joinDatas(createSubDatas());

    childWheelView = (WheelView) findViewById(R.id.child_wheelview);
    childWheelView.setWheelAdapter(new ArrayWheelAdapter(this));
    childWheelView.setSkin(WheelView.Skin.Holo);
    childWheelView.setWheelData(
        createChildDatas()
            .get(
                createSubDatas()
                    .get(createMainDatas().get(mainWheelView.getSelection()))
                    .get(subWheelView.getSelection())));
    childWheelView.setStyle(style);
    subWheelView.join(childWheelView);
    subWheelView.joinDatas(createChildDatas());
  }
Example #2
0
  /** holo皮肤 */
  private void initWheel2() {
    hourWheelView = (WheelView) findViewById(R.id.hour_wheelview);
    hourWheelView.setWheelAdapter(new ArrayWheelAdapter(this));
    hourWheelView.setSkin(WheelView.Skin.Holo);
    hourWheelView.setWheelData(createHours());
    WheelView.WheelViewStyle style = new WheelView.WheelViewStyle();
    style.selectedTextColor = Color.parseColor("#0288ce");
    style.textColor = Color.GRAY;
    style.selectedTextSize = 20;
    hourWheelView.setStyle(style);
    hourWheelView.setExtraText("时", Color.parseColor("#0288ce"), 40, 70);

    minuteWheelView = (WheelView) findViewById(R.id.minute_wheelview);
    minuteWheelView.setWheelAdapter(new ArrayWheelAdapter(this));
    minuteWheelView.setSkin(WheelView.Skin.Holo);
    minuteWheelView.setWheelData(createMinutes());
    minuteWheelView.setStyle(style);
    minuteWheelView.setExtraText("分", Color.parseColor("#0288ce"), 40, 70);

    secondWheelView = (WheelView) findViewById(R.id.second_wheelview);
    secondWheelView.setWheelAdapter(new ArrayWheelAdapter(this));
    secondWheelView.setSkin(WheelView.Skin.Holo);
    secondWheelView.setWheelData(createMinutes());
    secondWheelView.setStyle(style);
    secondWheelView.setExtraText("秒", Color.parseColor("#0288ce"), 40, 70);
  }
Example #3
0
  /** common皮肤、图文混排无皮肤、自定义布局 */
  private void initWheel3() {
    commonWheelView = (WheelView) findViewById(R.id.common_wheelview);
    commonWheelView.setWheelAdapter(new ArrayWheelAdapter(this));
    commonWheelView.setSkin(WheelView.Skin.Common);
    commonWheelView.setWheelData(createArrays());

    simpleWheelView = (WheelView) findViewById(R.id.simple_wheelview);
    simpleWheelView.setWheelAdapter(new SimpleWheelAdapter(this));
    simpleWheelView.setWheelSize(5);
    simpleWheelView.setWheelData(createDatas());
    simpleWheelView.setSkin(WheelView.Skin.None);
    simpleWheelView.setLoop(true);
    simpleWheelView.setWheelClickable(true);
    simpleWheelView.setOnWheelItemClickListener(
        new WheelView.OnWheelItemClickListener() {
          @Override
          public void onItemClick(int position, Object o) {
            WheelUtils.log("click:" + position);
          }
        });
    simpleWheelView.setOnWheelItemSelectedListener(
        new WheelView.OnWheelItemSelectedListener<WheelData>() {
          @Override
          public void onItemSelected(int position, WheelData data) {
            WheelUtils.log("selected:" + position);
          }
        });

    myWheelView = (WheelView) findViewById(R.id.my_wheelview);
    myWheelView.setWheelAdapter(new MyWheelAdapter(this));
    myWheelView.setWheelSize(5);
    myWheelView.setSkin(WheelView.Skin.Holo);
    myWheelView.setWheelData(createArrays());
    myWheelView.setSelection(2);
    WheelView.WheelViewStyle style = new WheelView.WheelViewStyle();
    style.backgroundColor = Color.YELLOW;
    style.textColor = Color.DKGRAY;
    style.selectedTextColor = Color.GREEN;
    myWheelView.setStyle(style);
  }