Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

style not applied problem! #46

Open
hzandi opened this issue Dec 17, 2017 · 1 comment
Open

style not applied problem! #46

hzandi opened this issue Dec 17, 2017 · 1 comment

Comments

@hzandi
Copy link

hzandi commented Dec 17, 2017

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);
@wosika
Copy link

wosika commented May 22, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants