diff options
| author | Yigit Boyar <yboyar@google.com> | 2014-08-07 16:08:41 -0700 |
|---|---|---|
| committer | Yigit Boyar <yboyar@google.com> | 2014-08-07 23:10:06 +0000 |
| commit | 661041194c0c5b0fe1ee659589531397e2d58d41 (patch) | |
| tree | 9be2e6deedfa38cf264e11cd69e980e6ca31487c /core/java/android | |
| parent | 0a4ea30c796a458074512a48f41e4b274b948ad2 (diff) | |
Fix RTL horizontal spacing in Gridview
Bug: 16659566
Change-Id: I0e7c834c6fedf39562fe880284373eda43412563
Diffstat (limited to 'core/java/android')
| -rw-r--r-- | core/java/android/widget/GridView.java | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/core/java/android/widget/GridView.java b/core/java/android/widget/GridView.java index 33cc66e55bc2..d263625f73be 100644 --- a/core/java/android/widget/GridView.java +++ b/core/java/android/widget/GridView.java @@ -351,6 +351,7 @@ public class GridView extends AbsListView { final int selectedPosition = mSelectedPosition; View child = null; + final int nextChildDir = isLayoutRtl ? -1 : +1; for (int pos = startPos; pos < last; pos++) { // is this the selected item? boolean selected = pos == selectedPosition; @@ -359,9 +360,9 @@ public class GridView extends AbsListView { final int where = flow ? -1 : pos - startPos; child = makeAndAddView(pos, y, flow, nextLeft, selected, where); - nextLeft += (isLayoutRtl ? -1 : +1) * columnWidth; + nextLeft += nextChildDir * columnWidth; if (pos < last - 1) { - nextLeft += horizontalSpacing; + nextLeft += nextChildDir * horizontalSpacing; } if (selected && (hasFocus || inClick)) { |
