summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Powell <adamp@google.com>2012-03-21 17:04:28 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2012-03-21 17:04:28 -0700
commitef08c1cd919ada0b4cd0c6ef0ade509d32f100b0 (patch)
tree527e95f4e6416beebc49a26040f31dd1ae11a140
parentaef46a61be9fa3371ed40496f907af41ed4b71d5 (diff)
parent0b7413d5d6239b7bc43816bea5187b323a633b11 (diff)
downloadframeworks_base-ef08c1cd919ada0b4cd0c6ef0ade509d32f100b0.zip
frameworks_base-ef08c1cd919ada0b4cd0c6ef0ade509d32f100b0.tar.gz
frameworks_base-ef08c1cd919ada0b4cd0c6ef0ade509d32f100b0.tar.bz2
Merge "GridView attribute updates"
-rw-r--r--api/current.txt6
-rw-r--r--core/java/android/widget/GridView.java100
2 files changed, 105 insertions, 1 deletions
diff --git a/api/current.txt b/api/current.txt
index 665b054..2532716 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -26621,8 +26621,14 @@ package android.widget {
ctor public GridView(android.content.Context, android.util.AttributeSet);
ctor public GridView(android.content.Context, android.util.AttributeSet, int);
method public android.widget.ListAdapter getAdapter();
+ method public int getColumnWidth();
+ method public int getGravity();
+ method public int getHorizontalSpacing();
method public int getNumColumns();
+ method public int getRequestedColumnWidth();
+ method public int getRequestedHorizontalSpacing();
method public int getStretchMode();
+ method public int getVerticalSpacing();
method public void setColumnWidth(int);
method public void setGravity(int);
method public void setHorizontalSpacing(int);
diff --git a/core/java/android/widget/GridView.java b/core/java/android/widget/GridView.java
index 739bcce..0f1dab5 100644
--- a/core/java/android/widget/GridView.java
+++ b/core/java/android/widget/GridView.java
@@ -1908,7 +1908,8 @@ public class GridView extends AbsListView {
}
/**
- * Describes how the child views are horizontally aligned. Defaults to Gravity.LEFT
+ * Set the gravity for this grid. Gravity describes how the child views
+ * are horizontally aligned. Defaults to Gravity.LEFT
*
* @param gravity the gravity to apply to this grid's children
*
@@ -1922,6 +1923,17 @@ public class GridView extends AbsListView {
}
/**
+ * Describes how the child views are horizontally aligned. Defaults to Gravity.LEFT
+ *
+ * @return the gravity that will be applied to this grid's children
+ *
+ * @attr ref android.R.styleable#GridView_gravity
+ */
+ public int getGravity() {
+ return mGravity;
+ }
+
+ /**
* Set the amount of horizontal (x) spacing to place between each item
* in the grid.
*
@@ -1937,6 +1949,44 @@ public class GridView extends AbsListView {
}
}
+ /**
+ * Returns the amount of horizontal spacing currently used between each item in the grid.
+ *
+ * <p>This is only accurate for the current layout. If {@link #setHorizontalSpacing(int)}
+ * has been called but layout is not yet complete, this method may return a stale value.
+ * To get the horizontal spacing that was explicitly requested use
+ * {@link #getRequestedHorizontalSpacing()}.</p>
+ *
+ * @return Current horizontal spacing between each item in pixels
+ *
+ * @see #setHorizontalSpacing(int)
+ * @see #getRequestedHorizontalSpacing()
+ *
+ * @attr ref android.R.styleable#GridView_horizontalSpacing
+ */
+ public int getHorizontalSpacing() {
+ return mHorizontalSpacing;
+ }
+
+ /**
+ * Returns the requested amount of horizontal spacing between each item in the grid.
+ *
+ * <p>The value returned may have been supplied during inflation as part of a style,
+ * the default GridView style, or by a call to {@link #setHorizontalSpacing(int)}.
+ * If layout is not yet complete or if GridView calculated a different horizontal spacing
+ * from what was requested, this may return a different value from
+ * {@link #getHorizontalSpacing()}.</p>
+ *
+ * @return The currently requested horizontal spacing between items, in pixels
+ *
+ * @see #setHorizontalSpacing(int)
+ * @see #getHorizontalSpacing()
+ *
+ * @attr ref android.R.styleable#GridView_horizontalSpacing
+ */
+ public int getRequestedHorizontalSpacing() {
+ return mRequestedHorizontalSpacing;
+ }
/**
* Set the amount of vertical (y) spacing to place between each item
@@ -1945,6 +1995,8 @@ public class GridView extends AbsListView {
* @param verticalSpacing The amount of vertical space between items,
* in pixels.
*
+ * @see #getVerticalSpacing()
+ *
* @attr ref android.R.styleable#GridView_verticalSpacing
*/
public void setVerticalSpacing(int verticalSpacing) {
@@ -1955,6 +2007,19 @@ public class GridView extends AbsListView {
}
/**
+ * Returns the amount of vertical spacing between each item in the grid.
+ *
+ * @return The vertical spacing between items in pixels
+ *
+ * @see #setVerticalSpacing(int)
+ *
+ * @attr ref android.R.styleable#GridView_verticalSpacing
+ */
+ public int getVerticalSpacing() {
+ return mVerticalSpacing;
+ }
+
+ /**
* Control how items are stretched to fill their space.
*
* @param stretchMode Either {@link #NO_STRETCH},
@@ -1988,6 +2053,39 @@ public class GridView extends AbsListView {
}
/**
+ * Return the width of a column in the grid.
+ *
+ * <p>This may not be valid yet if a layout is pending.</p>
+ *
+ * @return The column width in pixels
+ *
+ * @see #setColumnWidth(int)
+ * @see #getRequestedColumnWidth()
+ *
+ * @attr ref android.R.styleable#GridView_columnWidth
+ */
+ public int getColumnWidth() {
+ return mColumnWidth;
+ }
+
+ /**
+ * Return the requested width of a column in the grid.
+ *
+ * <p>This may not be the actual column width used. Use {@link #getColumnWidth()}
+ * to retrieve the current real width of a column.</p>
+ *
+ * @return The requested column width in pixels
+ *
+ * @see #setColumnWidth(int)
+ * @see #getColumnWidth()
+ *
+ * @attr ref android.R.styleable#GridView_columnWidth
+ */
+ public int getRequestedColumnWidth() {
+ return mRequestedColumnWidth;
+ }
+
+ /**
* Set the number of columns in the grid
*
* @param numColumns The desired number of columns.