CircleDisplay icon indicating copy to clipboard operation
CircleDisplay copied to clipboard

Disappears in ScrollView

Open apatrone opened this issue 9 years ago • 1 comments

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?

apatrone avatar May 11 '16 12:05 apatrone

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);
    }

alimortazavi avatar Jun 15 '16 13:06 alimortazavi