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

if ChildView Width > Screen width then shows half view #20

Open
nixit28 opened this issue Oct 20, 2012 · 8 comments
Open

if ChildView Width > Screen width then shows half view #20

nixit28 opened this issue Oct 20, 2012 · 8 comments

Comments

@nixit28
Copy link

nixit28 commented Oct 20, 2012

Hi,
I have implemented Horizontal List view in to my application, It works great.
But I have encountered one problem which is
if child view's width exceeds from the screen width it shows the view till the screen size rest is cutoff from the screen.

any idea how to solve this problem

Thanks

@dinocore1
Copy link
Owner

No sorry, I have not had that problem. If you figure out how to solve it I
would love a git push request. Thanks.

On Sat, Oct 20, 2012 at 4:37 AM, Nixit Patel [email protected]:

Hi,
I have implemented Horizontal List view in to my application, It works
great.
But I have encountered one problem which is
if child view's width exceeds from the screen width it shows the view till
the screen size rest is cutoff from the screen.

any idea how to solve this problem

Thanks


Reply to this email directly or view it on GitHubhttps://github.com//issues/20.

@httpdispatch
Copy link

noticed same thing periodically on emulator 2.1 when scrolling
device-2012-12-11-112221

look at the left side. The most left thumb (serif) is partially visible. The ship thumb should not be on the screen anymore

@httpdispatch
Copy link

Tested this a little bit more. Seems that the view is not invalidated properly in some cases on android 2.1. Even if i force call invalidate some regions show invalid information.

@kazaky
Copy link

kazaky commented Feb 12, 2014

@httpdispatch also on my 4.4 kitkat ,, any solutions ??!!
thanks ,
device-2014-02-12-111809

@httpdispatch
Copy link

@kazaky How i remember i've fixed that issue by modifying method measureChild

private void measureChild(final View child) {
        child.measure(MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.UNSPECIFIED),
                MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.AT_MOST));
    }

@kazaky
Copy link

kazaky commented Feb 12, 2014

thanks@httpdispatch for the reply
there is no
measureChild(final View child)

only this one , with different parameters ,,
& i tried to edit it as u said , not working!

private void addAndMeasureChild(final View child, int viewPos) {
    LayoutParams params = child.getLayoutParams();
    if (params == null) {
        params = new LayoutParams(LayoutParams.FILL_PARENT,
                LayoutParams.FILL_PARENT);
    }

    addViewInLayout(child, viewPos, params, true);
    child.measure(
            MeasureSpec.makeMeasureSpec(getWidth(), MeasureSpec.AT_MOST),
            MeasureSpec.makeMeasureSpec(getHeight(), MeasureSpec.AT_MOST));
}

@httpdispatch
Copy link

I've did a couple of bugfixes so don't remember which one fixed the issue. You may try my bugfixes version of HorizontalListView here
https://gist.github.com/httpdispatch/8953995

Also please note that you should explicitly set Layout width for you child views to be larger than screen size to overcome the issue

@kazaky
Copy link

kazaky commented Feb 12, 2014

i'll check that ,
Thanks Sir :D

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

4 participants