RaghavSood / AndroidCircularSeekBar

A circular seek bar for Android
Other
285 stars 127 forks source link

Not setting / displaying in Fragment correctly #10

Open casillic opened 10 years ago

casillic commented 10 years ago

I can use circularSeekBar in a fragment which is displayed in via an activity fine. (The first fragment displayed.) I have a problem when it is not the first fragment that is displayed. E.g. If I had another Fragment displaying and I replace it with the one that contains the circularSeekBar. The circularSeekBar is display but not correctly. It appears it is not fully updated. I can touch it and then it corrects itself. What can I do to correct this. It appears it needs some type of refresh.

casillic commented 10 years ago

Okay, I've found the problem: Change the onMeasure(int widthMeasureSpec, int heightMeasureSpec) as follows:

@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec);

    width = View.MeasureSpec.getSize(widthMeasureSpec);
    height = View.MeasureSpec.getSize(heightMeasureSpec);