DevsmartLib-Android
DevsmartLib-Android copied to clipboard
if ChildView Width > Screen width then shows half view
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
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/dinocore1/DevsmartLib-Android/issues/20.
noticed same thing periodically on emulator 2.1 when scrolling
look at the left side. The most left thumb (serif) is partially visible. The ship thumb should not be on the screen anymore
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.
@httpdispatch also on my 4.4 kitkat ,, any solutions ??!!
thanks ,
@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));
}
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));
}
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
i'll check that , Thanks Sir :D