Merge "GridView attribute updates"

This commit is contained in:
Adam Powell
2012-03-21 17:04:28 -07:00
committed by Android (Google) Code Review
2 changed files with 105 additions and 1 deletions

View File

@@ -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);

View File

@@ -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
*
@@ -1921,6 +1922,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) {
@@ -1954,6 +2006,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.
*
@@ -1987,6 +2052,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
*