WheelView icon indicating copy to clipboard operation
WheelView copied to clipboard

style not applied problem!

Open hzandi opened this issue 7 years ago • 1 comments

bellow style not working , and text still is black , and there is no difference between text size and selected text size in!!!! why? is there a problem in this code?

WheelView.WheelViewStyle style = new WheelView.WheelViewStyle();
      style.backgroundColor = Color.TRANSPARENT;
      style.selectedTextColor = Color.parseColor("#f1f2f2");
      style.textColor = Color.parseColor("#9a9a9a");
      style.holoBorderColor = Color.parseColor("#666666");
      style.textSize = 16;
      style.selectedTextSize = 20;

      WheelView simpleWheelView = (WheelView) view.findViewById(R.id.year_wheelview);
      simpleWheelView.setWheelAdapter(new ChannelWheelAdapter(getContext()));
      simpleWheelView.setWheelSize(7);
      simpleWheelView.setWheelData(createDatas());
      simpleWheelView.setLoop(true);
      simpleWheelView.setSkin(WheelView.Skin.Holo);
      simpleWheelView.setStyle(style);

hzandi avatar Dec 17 '17 13:12 hzandi

hello,you can see the source. in the WheelView line 222

private void addOnGlobalLayoutListener() { getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver .OnGlobalLayoutListener() { @Override public void onGlobalLayout() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { getViewTreeObserver().removeOnGlobalLayoutListener(this); } else { getViewTreeObserver().removeGlobalOnLayoutListener(this); } if (getChildCount() > 0 && mItemH == 0) { mItemH = getChildAt(0).getHeight(); if (mItemH != 0) { ViewGroup.LayoutParams params = getLayoutParams(); params.height = mItemH * mWheelSize; refreshVisibleItems(getFirstVisiblePosition(), getCurrentPosition() + mWheelSize / 2, mWheelSize / 2); setBackground(); } else { throw new WheelViewException("wheel item is error."); } } } }); }

remove that

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { getViewTreeObserver().removeOnGlobalLayoutListener(this); } else { getViewTreeObserver().removeGlobalOnLayoutListener(this); }

you need pull the source ,fix it

wosika avatar May 22 '18 09:05 wosika