Skip to content

Commit

Permalink
Merge pull request #5601 from hieupham007/timob-16485
Browse files Browse the repository at this point in the history
timob-16485: fix layout issue for horizontal scrollview
  • Loading branch information
vishalduggal committed Apr 17, 2014
2 parents 2bd6e2f + d260bf2 commit 1b9b7f9
Showing 1 changed file with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,8 @@ public TiVerticalScrollView(Context context, LayoutArrangement arrangement)
setScrollBarStyle(SCROLLBARS_INSIDE_OVERLAY);

layout = new TiScrollViewLayout(context, arrangement);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
layout.setLayoutParams(params);
super.addView(layout, params);
}
Expand Down Expand Up @@ -272,8 +272,8 @@ public TiHorizontalScrollView(Context context, LayoutArrangement arrangement)
setScrollContainer(true);

layout = new TiScrollViewLayout(context, arrangement);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT,
ViewGroup.LayoutParams.FILL_PARENT);
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT);
layout.setLayoutParams(params);
super.addView(layout, params);

Expand Down Expand Up @@ -456,14 +456,15 @@ public void processProperties(KrollDict d)

int type = TYPE_VERTICAL;
boolean deduced = false;

if (d.containsKey(TiC.PROPERTY_WIDTH) && d.containsKey(TiC.PROPERTY_CONTENT_WIDTH)) {
Object width = d.get(TiC.PROPERTY_WIDTH);
Object contentWidth = d.get(TiC.PROPERTY_CONTENT_WIDTH);
if (width.equals(contentWidth) || showVerticalScrollBar) {
type = TYPE_VERTICAL;
deduced = true;
}

}

if (d.containsKey(TiC.PROPERTY_HEIGHT) && d.containsKey(TiC.PROPERTY_CONTENT_HEIGHT)) {
Expand Down Expand Up @@ -519,9 +520,12 @@ public void processProperties(KrollDict d)
((TiScrollViewLayout) scrollViewLayout).setCanCancelEvents(TiConvert.toBoolean(d, TiC.PROPERTY_CAN_CANCEL_EVENTS));
}

if (d.containsKey(TiC.PROPERTY_HORIZONTAL_WRAP)) {
scrollViewLayout.setEnableHorizontalWrap(TiConvert.toBoolean(d, TiC.PROPERTY_HORIZONTAL_WRAP));
boolean autoContentWidth = (scrollViewLayout.getContentProperty(TiC.PROPERTY_CONTENT_WIDTH) == scrollViewLayout.AUTO);
boolean wrap = !autoContentWidth;
if (d.containsKey(TiC.PROPERTY_HORIZONTAL_WRAP) && wrap) {
wrap = TiConvert.toBoolean(d, TiC.PROPERTY_HORIZONTAL_WRAP, true);
}
scrollViewLayout.setEnableHorizontalWrap(wrap);

if (d.containsKey(TiC.PROPERTY_OVER_SCROLL_MODE)) {
if (Build.VERSION.SDK_INT >= 9) {
Expand Down

0 comments on commit 1b9b7f9

Please sign in to comment.