android.widget
Class GridView

java.lang.Object
  extended by android.view.View
      extended by android.view.ViewGroup
          extended by android.widget.AdapterView<ListAdapter>
              extended by android.widget.AbsListView
                  extended by android.widget.GridView
All Implemented Interfaces:
Drawable.Callback, NoCopySpan, TextWatcher, AccessibilityEventSource, KeyEvent.Callback, ViewManager, ViewParent, ViewTreeObserver.OnGlobalLayoutListener, ViewTreeObserver.OnTouchModeChangeListener, Filter.FilterListener

public class GridView
extends AbsListView


Nested Class Summary
 
Nested classes/interfaces inherited from class android.widget.AbsListView
AbsListView.LayoutParams, AbsListView.OnScrollListener, AbsListView.RecyclerListener
 
Nested classes/interfaces inherited from class android.widget.AdapterView
AdapterView.AdapterContextMenuInfo, AdapterView.OnItemClickListener, AdapterView.OnItemLongClickListener, AdapterView.OnItemSelectedListener
 
Nested classes/interfaces inherited from class android.view.ViewGroup
ViewGroup.MarginLayoutParams, ViewGroup.OnHierarchyChangeListener
 
Nested classes/interfaces inherited from class android.view.View
View.BaseSavedState, View.MeasureSpec, View.OnClickListener, View.OnCreateContextMenuListener, View.OnFocusChangeListener, View.OnKeyListener, View.OnLongClickListener, View.OnTouchListener
 
Nested classes/interfaces inherited from interface android.text.NoCopySpan
NoCopySpan.Concrete
 
Field Summary
static int AUTO_FIT
           
static int NO_STRETCH
           
static int STRETCH_COLUMN_WIDTH
           
static int STRETCH_SPACING
           
static int STRETCH_SPACING_UNIFORM
           
 
Fields inherited from class android.widget.AbsListView
TRANSCRIPT_MODE_ALWAYS_SCROLL, TRANSCRIPT_MODE_DISABLED, TRANSCRIPT_MODE_NORMAL
 
Fields inherited from class android.widget.AdapterView
INVALID_POSITION, INVALID_ROW_ID, ITEM_VIEW_TYPE_HEADER_OR_FOOTER, ITEM_VIEW_TYPE_IGNORE
 
Fields inherited from class android.view.ViewGroup
CLIP_TO_PADDING_MASK, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE
 
Fields inherited from class android.view.View
DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, INVISIBLE, KEEP_SCREEN_ON, NO_ID, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET
 
Constructor Summary
GridView(Context context)
           
GridView(Context context, AttributeSet attrs)
           
GridView(Context context, AttributeSet attrs, int defStyle)
           
 
Method Summary
protected  void attachLayoutAnimationParameters(View child, ViewGroup.LayoutParams params, int index, int count)
           
protected  int computeVerticalScrollExtent()
           
protected  int computeVerticalScrollOffset()
           
protected  int computeVerticalScrollRange()
           
 ListAdapter getAdapter()
           
 int getStretchMode()
           
protected  void layoutChildren()
           
protected  void onFocusChanged(boolean gainFocus, int direction, Rect previouslyFocusedRect)
           
 boolean onKeyDown(int keyCode, KeyEvent event)
           
 boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event)
           
 boolean onKeyUp(int keyCode, KeyEvent event)
           
protected  void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
           
 void setAdapter(ListAdapter adapter)
           
 void setColumnWidth(int columnWidth)
           
 void setGravity(int gravity)
           
 void setHorizontalSpacing(int horizontalSpacing)
           
 void setNumColumns(int numColumns)
           
 void setSelection(int position)
           
 void setStretchMode(int stretchMode)
           
 void setVerticalSpacing(int verticalSpacing)
           
 
Methods inherited from class android.widget.AbsListView
addTouchables, afterTextChanged, beforeTextChanged, checkInputConnectionProxy, checkLayoutParams, clearTextFilter, dispatchDraw, dispatchSetPressed, draw, drawableStateChanged, generateLayoutParams, generateLayoutParams, getBottomFadingEdgeStrength, getCacheColorHint, getContextMenuInfo, getFocusedRect, getListPaddingBottom, getListPaddingLeft, getListPaddingRight, getListPaddingTop, getSelectedView, getSelector, getSolidColor, getTextFilter, getTopFadingEdgeStrength, getTranscriptMode, handleDataChanged, hasTextFilter, invalidateViews, isFastScrollEnabled, isInFilterMode, isScrollingCacheEnabled, isSmoothScrollbarEnabled, isStackFromBottom, isTextFilterEnabled, onAttachedToWindow, onCreateDrawableState, onCreateInputConnection, onDetachedFromWindow, onFilterComplete, onGlobalLayout, onInterceptTouchEvent, onLayout, onRestoreInstanceState, onSaveInstanceState, onSizeChanged, onTextChanged, onTouchEvent, onTouchModeChanged, onWindowFocusChanged, pointToPosition, pointToRowId, reclaimViews, requestLayout, setCacheColorHint, setDrawSelectorOnTop, setFastScrollEnabled, setFilterText, setOnScrollListener, setRecyclerListener, setScrollIndicators, setScrollingCacheEnabled, setSelector, setSelector, setSmoothScrollbarEnabled, setStackFromBottom, setTextFilterEnabled, setTranscriptMode, showContextMenuForChild, verifyDrawable
 
Methods inherited from class android.widget.AdapterView
addView, addView, addView, addView, canAnimate, dispatchPopulateAccessibilityEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, getCount, getEmptyView, getFirstVisiblePosition, getItemAtPosition, getItemIdAtPosition, getLastVisiblePosition, getOnItemClickListener, getOnItemLongClickListener, getOnItemSelectedListener, getPositionForView, getSelectedItem, getSelectedItemId, getSelectedItemPosition, performItemClick, removeAllViews, removeView, removeViewAt, setEmptyView, setFocusable, setFocusableInTouchMode, setOnClickListener, setOnItemClickListener, setOnItemLongClickListener, setOnItemSelectedListener
 
Methods inherited from class android.view.ViewGroup
addFocusables, addFocusables, addStatesFromChildren, addView, addViewInLayout, addViewInLayout, attachViewToParent, bringChildToFront, childDrawableStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchFreezeSelfOnly, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchSetSelected, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, drawChild, findFocus, fitSystemWindows, focusableViewAvailable, focusSearch, gatherTransparentRegion, generateDefaultLayoutParams, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getPersistentDrawingCache, hasFocus, hasFocusable, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, measureChild, measureChildren, measureChildWithMargins, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onRequestFocusInDescendants, recomputeViewAttributes, removeAllViewsInLayout, removeDetachedView, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setOnHierarchyChangeListener, setPadding, setPersistentDrawingCache, setStaticTransformationsEnabled, startLayoutAnimation, updateViewLayout
 
Methods inherited from class android.view.View
awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, cancelLongPress, clearAnimation, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, createContextMenu, destroyDrawingCache, finalize, findViewById, findViewWithTag, focusSearch, forceLayout, getAnimation, getApplicationWindowToken, getBackground, getBaseline, getBottom, getBottomPaddingOffset, getContentDescription, getContext, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFocusables, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getKeepScreenOn, getKeyDispatcherState, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMeasuredHeight, getMeasuredWidth, getNextFocusDownId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getResources, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getScrollBarStyle, getScrollX, getScrollY, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTag, getTop, getTopPaddingOffset, getTouchables, getTouchDelegate, getVerticalFadingEdgeLength, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, isClickable, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isInEditMode, isInTouchMode, isLayoutRequested, isLongClickable, isOpaque, isPaddingOffsetRequired, isPressed, isSaveEnabled, isScrollbarFadingEnabled, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onCheckIsTextEditor, onCreateContextMenu, onDraw, onDrawScrollBars, onFinishInflate, onFinishTemporaryDetach, onKeyLongPress, onKeyPreIme, onKeyShortcut, onScrollChanged, onSetAlpha, onStartTemporaryDetach, onTrackballEvent, onWindowVisibilityChanged, performClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, refreshDrawableState, removeCallbacks, requestFocus, requestFocus, requestFocusFromTouch, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAnimation, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setClickable, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setHapticFeedbackEnabled, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setId, setKeepScreenOn, setLayoutParams, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnCreateContextMenuListener, setOnFocusChangeListener, setOnKeyListener, setOnLongClickListener, setOnTouchListener, setPressed, setSaveEnabled, setScrollbarFadingEnabled, setScrollBarStyle, setScrollContainer, setSelected, setSoundEffectsEnabled, setTag, setTag, setTouchDelegate, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVisibility, setWillNotCacheDrawing, setWillNotDraw, showContextMenu, startAnimation, unscheduleDrawable, unscheduleDrawable, willNotCacheDrawing, willNotDraw
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface android.view.ViewParent
createContextMenu, getParent, isLayoutRequested
 

Field Detail

NO_STRETCH

public static final int NO_STRETCH
See Also:
Constant Field Values

STRETCH_SPACING

public static final int STRETCH_SPACING
See Also:
Constant Field Values

STRETCH_COLUMN_WIDTH

public static final int STRETCH_COLUMN_WIDTH
See Also:
Constant Field Values

STRETCH_SPACING_UNIFORM

public static final int STRETCH_SPACING_UNIFORM
See Also:
Constant Field Values

AUTO_FIT

public static final int AUTO_FIT
See Also:
Constant Field Values
Constructor Detail

GridView

public GridView(Context context)

GridView

public GridView(Context context,
                AttributeSet attrs)

GridView

public GridView(Context context,
                AttributeSet attrs,
                int defStyle)
Method Detail

getAdapter

public ListAdapter getAdapter()
Specified by:
getAdapter in class AdapterView<ListAdapter>

setAdapter

public void setAdapter(ListAdapter adapter)
Specified by:
setAdapter in class AdapterView<ListAdapter>

onMeasure

protected void onMeasure(int widthMeasureSpec,
                         int heightMeasureSpec)
Overrides:
onMeasure in class AbsListView

attachLayoutAnimationParameters

protected void attachLayoutAnimationParameters(View child,
                                               ViewGroup.LayoutParams params,
                                               int index,
                                               int count)
Overrides:
attachLayoutAnimationParameters in class ViewGroup

layoutChildren

protected void layoutChildren()
Overrides:
layoutChildren in class AbsListView

setSelection

public void setSelection(int position)
Specified by:
setSelection in class AdapterView<ListAdapter>

onKeyDown

public boolean onKeyDown(int keyCode,
                         KeyEvent event)
Specified by:
onKeyDown in interface KeyEvent.Callback
Overrides:
onKeyDown in class AbsListView

onKeyMultiple

public boolean onKeyMultiple(int keyCode,
                             int repeatCount,
                             KeyEvent event)
Specified by:
onKeyMultiple in interface KeyEvent.Callback
Overrides:
onKeyMultiple in class View

onKeyUp

public boolean onKeyUp(int keyCode,
                       KeyEvent event)
Specified by:
onKeyUp in interface KeyEvent.Callback
Overrides:
onKeyUp in class AbsListView

onFocusChanged

protected void onFocusChanged(boolean gainFocus,
                              int direction,
                              Rect previouslyFocusedRect)
Overrides:
onFocusChanged in class AbsListView

setGravity

public void setGravity(int gravity)

setHorizontalSpacing

public void setHorizontalSpacing(int horizontalSpacing)

setVerticalSpacing

public void setVerticalSpacing(int verticalSpacing)

setStretchMode

public void setStretchMode(int stretchMode)

getStretchMode

public int getStretchMode()

setColumnWidth

public void setColumnWidth(int columnWidth)

setNumColumns

public void setNumColumns(int numColumns)

computeVerticalScrollExtent

protected int computeVerticalScrollExtent()
Overrides:
computeVerticalScrollExtent in class AbsListView

computeVerticalScrollOffset

protected int computeVerticalScrollOffset()
Overrides:
computeVerticalScrollOffset in class AbsListView

computeVerticalScrollRange

protected int computeVerticalScrollRange()
Overrides:
computeVerticalScrollRange in class AbsListView


Copyright © 2008-2010. All Rights Reserved.