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

Disappears in ScrollView #5

Open
apatrone opened this issue May 11, 2016 · 1 comment
Open

Disappears in ScrollView #5

apatrone opened this issue May 11, 2016 · 1 comment

Comments

@apatrone
Copy link

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
Copy link

alimortazavi commented Jun 15, 2016

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

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