PhilJay / CircleDisplay

Android View for displaying and selecting values in a circle-shaped View, with animations and touch gestures.
288 stars 103 forks source link

Disappears in ScrollView #5

Open apatrone opened 8 years ago

apatrone commented 8 years ago

I have an activity that shows a CircleDisplay beneath a chart. All works well when the layout is placed inside a LinearLayout. But when I place this LinearLayout inside a ScrollView, the CircleDisplay disappears (while the chart is still being shown correctly). Can this be a bug or am I missing something?

alimortazavi commented 8 years ago

when using a custom view inside a Scroll view, you have to override onMeasure method and set width and height for your custom view.. eg:

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

        int widthMeasure = MeasureSpec.makeMeasureSpec(200, MeasureSpec.EXACTLY);
        int heightMeasure = MeasureSpec.makeMeasureSpec(200, MeasureSpec.EXACTLY);

        setMeasuredDimension(widthMeasure, heightMeasure);
    }