Type | Reason |
---|---|
AbsSavedState | A Android.OS.Parcelable implementation that should be used by inheritance hierarchies to ensure the state of all classes along the chain is saved. |
AbsSavedState+InterfaceConsts | Documentation for this section has not yet been entered. |
AccessibilityLiveRegion | Enumerates values returned by several types. |
ActionMode | Represents a contextual mode of the user interface. |
ActionMode+ICallback | Callback interface for action modes. |
ActionProvider | An ActionProvider defines rich menu interaction in a single component. |
ActionProvider+IVisibilityListener | Listens to changes in visibility as reported by Android.Views.ActionProvider.RefreshVisibility. |
ActionProvider+VisibilityEventArgs | Provides data for the Android.Views.ActionProvider.Visibility event. |
Axis | Enumerates values returned by several types and taken as a parameter of several types. |
Choreographer | Coordinates the timing of animations, input and drawing. |
Choreographer+IFrameCallback | Implement this interface to receive a callback when a new display frame is being rendered. |
ContextThemeWrapper | A ContextWrapper that allows you to modify the theme from what is in the wrapped context. |
DescendantFocusability | Enumerates values returned by several types. |
Display | Provides information about the size and density of a logical display. |
DisplayFlags | Enumerates values returned by several types and taken as a parameter of the Android.Media.Projection.MediaProjection.CreateVirtualDisplay member. |
DisplayState | Enumerates values returned by several types. |
DragAction | Enumerates values returned by several types. |
DragEvent | Represents an event that is sent out by the system at various times during a drag and drop operation. |
DragEvent+InterfaceConsts | Documentation for this section has not yet been entered. |
DrawingCacheQuality | Enumerates values returned by several types. |
Edge | Enumerates values returned by several types and taken as a parameter of several types. |
FeedbackConstants | Enumerates values returned by the Android.Views.FeedbackConstants.KeyboardTap, Android.Views.FeedbackConstants.LongPress, and Android.Views.FeedbackConstants.VirtualKey members and taken as a parameter of the Android.Views.View.PerformHapticFeedback, and Android.Views.View.PerformHapticFeedback members. |
FeedbackFlags | Enumerates values returned by the Android.Views.FeedbackFlags.IgnoreGlobalSetting, and Android.Views.FeedbackFlags.IgnoreViewSetting members and taken as a parameter of the Android.Views.View.PerformHapticFeedback member. |
FindViewsWith | Enumerates values returned by the Android.Views.FindViewsWith.ContentDescription, Android.Views.FindViewsWith.Text, and Android.Views.View.FindViewsWithContentDescription members and taken as a parameter of the Android.Views.View.FindViewsWithText, and Android.Views.View.FindViewsWithText members. |
FocusablesFlags | Enumerates values returned by the Android.Views.FocusablesFlags.All, and Android.Views.FocusablesFlags.TouchMode members and taken as a parameter of the Android.Views.View.AddFocusables member. |
FocusFinder | The algorithm used for finding the next focusable view in a given direction from a view that currently has focus. |
FocusSearchDirection | |
FrameStats | This is the base class for frame statistics. |
GestureDetector | Detects various gestures and events using the supplied Android.Views.MotionEvents. |
GestureDetector+DoubleTapEventArgs | Provides data for the Android.Views.GestureDetector.DoubleTap event. |
GestureDetector+DoubleTapEventEventArgs | Provides data for the Android.Views.GestureDetector.DoubleTapEvent event. |
GestureDetector+DownEventArgs | Documentation for this section has not yet been entered. |
GestureDetector+FlingEventArgs | Documentation for this section has not yet been entered. |
GestureDetector+IOnDoubleTapListener | The listener that is used to notify when a double-tap or a confirmed single-tap occur. |
GestureDetector+IOnGestureListener | The listener that is used to notify when gestures occur. |
GestureDetector+LongPressEventArgs | Documentation for this section has not yet been entered. |
GestureDetector+ScrollEventArgs | Documentation for this section has not yet been entered. |
GestureDetector+ShowPressEventArgs | Documentation for this section has not yet been entered. |
GestureDetector+SimpleOnGestureListener | A convenience class to extend when you only want to listen for a subset of all the gestures. |
GestureDetector+SingleTapConfirmedEventArgs | Provides data for the Android.Views.GestureDetector.SingleTapConfirmed event. |
GestureDetector+SingleTapUpEventArgs | Documentation for this section has not yet been entered. |
Gravity | Standard constants and tools for placing an object within a potentially larger container. |
GravityFlags | Enumerates values returned by several types and taken as a parameter of several types. |
HapticFeedbackConstants | Constants to be used to perform haptic feedback effects via Android.Views.View.PerformHapticFeedback(Android.Views.FeedbackConstants) |
ICollapsibleActionView | When a Android.Views.View implements this interface it will receive callbacks when expanded or collapsed as an action view alongside the optional, app-specified callbacks to Android.Views.IMenuItemOnActionExpandListener. |
IContextMenu | Extension of Android.Views.Menu for context menus providing functionality to modify the header of the context menu. |
IContextMenuContextMenuInfo | Additional information regarding the creation of the context menu. |
IContextMenuExtensions | Documentation for this section has not yet been entered. |
IMenu | Interface for managing the items in a menu. |
IMenuExtensions | Documentation for this section has not yet been entered. |
IMenuItem | Interface for direct access to a previously created menu item. |
IMenuItemExtensions | Documentation for this section has not yet been entered. |
IMenuItemOnActionExpandListener | Interface definition for a callback to be invoked when a menu item marked with Android.Views.IMenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW is expanded or collapsed. |
IMenuItemOnMenuItemClickListener | Interface definition for a callback to be invoked when a menu item is clicked. |
ImportantForAccessibility | Enumerates values returned by several types. |
InflateException | This exception is thrown by an inflater on error conditions. |
InputDevice | Describes the capabilities of a particular input device. |
InputDevice+InterfaceConsts | Documentation for this section has not yet been entered. |
InputDevice+MotionRange | Provides information about the range of values for a particular Android.Views.MotionEvent axis. |
InputEvent | Common base class for input events. |
InputEvent+InterfaceConsts | Documentation for this section has not yet been entered. |
InputKeyboardType | Enumerates values returned by several types. |
InputQueue | An input queue provides a mechanism for an application to receive incoming input events. |
InputQueue+ICallback | Interface to receive notification of when an InputQueue is associated and dissociated with a thread. |
InputSourceType | Enumerates values returned by several types and taken as a parameter of several types. |
ISubMenu | Subclass of Android.Views.Menu for sub menus. |
ISubMenuExtensions | Documentation for this section has not yet been entered. |
ISurfaceHolder | Abstract interface to someone holding a display surface. |
ISurfaceHolderCallback | A client may implement this interface to receive information about changes to the surface. |
ISurfaceHolderCallback2 | Additional callbacks that can be received for Android.Views.ISurfaceHolderCallback. |
IViewManager | Interface to let you add and remove child views to an Activity. |
IViewParent | Defines the responsibilities for a class that will be a parent of a View. |
IWindowManager | The interface that apps use to talk to the window manager. |
KeyboardType | Enumerates values returned by several types. |
KeyCharacterMap | Describes the keys provided by a keyboard device and their associated labels. |
KeyCharacterMap+InterfaceConsts | Documentation for this section has not yet been entered. |
KeyCharacterMap+KeyData | Describes the character mappings associated with a key. |
KeyCharacterMap+UnavailableException | Thrown by Android.Views.KeyCharacterMap.Load(int) when a key character map could not be loaded. |
Keycode | Enumerates values returned by several types and taken as a parameter of several types. |
KeyEvent | Object used to report key and button events. |
KeyEvent+DispatcherState | Use with Android.Views.KeyEvent.Dispatch(Android.Views.KeyEvent.ICallback, Android.Views.KeyEvent.DispatcherState, Android.Views.KeyEvent.DispatcherState) for more advanced key dispatching, such as long presses. |
KeyEvent+ICallback | Documentation for this section has not yet been entered. |
KeyEventActions | Enumerates values returned by several types and taken as a parameter of several methods of Android.Views.KeyEvent. |
KeyEventFlags | Enumerates values returned by several types and taken as a parameter of several methods of Android.Views.KeyEvent. |
KeyModifierBehavior | Enumerates values returned by the Android.Views.KeyCharacterMap.ModifierBehavior, Android.Views.KeyModifierBehavior.Chorded, and Android.Views.KeyModifierBehavior.ChordedOrToggled members. |
LayerType | Enumerates values returned by several types and taken as a parameter of the Android.Views.View.SetLayerType member. |
LayoutDirection | Enumerates values returned by several types and taken as a parameter of the Android.Views.View.OnRtlPropertiesChanged, and Android.Views.ViewGroup.LayoutParams.ResolveLayoutDirection members. |
LayoutInflater | Instantiates a layout XML file into its corresponding Android.Views.View objects. |
LayoutInflater+IFactory | Documentation for this section has not yet been entered. |
LayoutInflater+IFactory2 | Documentation for this section has not yet been entered. |
LayoutInflater+IFilter | Hook to allow clients of the LayoutInflater to restrict the set of Views that are allowed to be inflated. |
MeasureSpecMode | Enumerates values returned by several types and taken as a parameter of the Android.Views.View.MeasureSpec.MakeMeasureSpec member. |
MemoryType | Enumerates values returned by several types. |
Menu | Interface for managing the items in a menu. |
MenuAppendFlags | Enumerates values returned by the Android.Views.MenuAppendFlags.AppendToGroup, and Android.Views.MenuAppendFlags.None members and taken as a parameter of the Android.Views.IMenu.AddIntentOptions member. |
MenuCategory | Enumerates values returned by several methods of Android.Views.MenuCategory. |
MenuConsts | Documentation for this section has not yet been entered. |
MenuInflater | This class is used to instantiate menu XML files into Menu objects. |
MenuItemActionCollapseEventArgs | Documentation for this section has not yet been entered. |
MenuItemActionExpandEventArgs | Documentation for this section has not yet been entered. |
MenuItemOnMenuItemClickEventArgs | Documentation for this section has not yet been entered. |
MenuPerformFlags | Enumerates values returned by the Android.Views.MenuPerformFlags.AlwaysPerformClose, Android.Views.MenuPerformFlags.None, and Android.Views.MenuPerformFlags.PerformNoClose members and taken as a parameter of several types. |
MetaKeyStates | Enumerates values returned by several types and taken as a parameter of several types. |
MotionEvent | Object used to report movement (mouse, pen, finger, trackball) events. |
MotionEvent+PointerCoords | Transfer object for pointer coordinates. |
MotionEvent+PointerProperties | Transfer object for pointer properties. |
MotionEventActions | Enumerates values returned by several types and taken as a parameter of several methods of Android.Views.MotionEvent. |
MotionEventButtonState | Enumerates values returned by several types and taken as a parameter of the Android.Views.MotionEvent.IsButtonPressed, and Android.Views.MotionEvent.Obtain members. |
MotionEventFlags | Enumerates values returned by several types and taken as a parameter of the Android.Views.MotionEvent.Obtain, and Android.Views.MotionEvent.Obtain members. |
MotionEventToolType | Enumerates values returned by several types. |
MotionRange | Enumerates values returned by several types. |
OrientationEventListener | Helper class for receiving notifications from the SensorManager when the orientation of the device has changed. |
OrientationListener | Helper class for receiving notifications from the SensorManager when the orientation of the device has changed. |
OverScrollMode | Enumerates values returned by several types. |
PersistentDrawingCaches | Enumerates values returned by several types. |
ScaleGestureDetector | Detects scaling transformation gestures using the supplied Android.Views.MotionEvents. |
ScaleGestureDetector+IOnScaleGestureListener | The listener for receiving notifications when gestures occur. |
ScaleGestureDetector+ScaleBeginEventArgs | Documentation for this section has not yet been entered. |
ScaleGestureDetector+ScaleEndEventArgs | Documentation for this section has not yet been entered. |
ScaleGestureDetector+ScaleEventArgs | Documentation for this section has not yet been entered. |
ScaleGestureDetector+SimpleOnScaleGestureListener | A convenience class to extend when you only want to listen for a subset of scaling-related events. |
ScreenState | Enumerates values returned by several types and taken as a parameter of the Android.Views.View.OnScreenStateChanged member. |
ScrollAxis | Enumerates values returned by several types and taken as a parameter of several types. |
ScrollbarPosition | Enumerates values returned by several types. |
ScrollbarStyles | Enumerates values returned by several types. |
ShowAsAction | Enumerates values returned by several methods of Android.Views.ShowAsAction and taken as a parameter of the Android.Views.IMenuItem.SetShowAsAction, and Android.Views.IMenuItem.SetShowAsActionFlags members. |
SoftInput | Enumerates values returned by several types and taken as a parameter of the Android.Views.Window.SetSoftInputMode member. |
SoundEffectConstants | Constants to be used to play sound effects via Android.Views.View.PlaySoundEffect(Android.Views.SoundEffects) |
SoundEffects | Enumerates values returned by several types and taken as a parameter of the Android.Views.View.PlaySoundEffect member. |
StatusBarVisibility | Enumerates values returned by several types and taken as a parameter of the Android.Views.View.IOnSystemUiVisibilityChangeListener.OnSystemUiVisibilityChange, and Android.Views.View.SystemUiVisibilityChangeEventArgs..ctor members. |
Surface | Handle onto a raw buffer that is being managed by the screen compositor. |
Surface+InterfaceConsts | Documentation for this section has not yet been entered. |
Surface+OutOfResourcesException | Exception thrown when a surface couldn't be created or resized. |
SurfaceHolderBadSurfaceTypeException | Exception that is thrown from Android.Views.ISurfaceHolder.LockCanvas when called on a Surface whose type is SURFACE_TYPE_PUSH_BUFFERS. |
SurfaceOrientation | Enumerates values returned by several types and taken as a parameter of the Android.Views.Surface.SetOrientation member. |
SurfaceType | Enumerates values returned by several methods of Android.Views.SurfaceType and taken as a parameter of the Android.Views.ISurfaceHolder.SetType member. |
SurfaceView | Provides a dedicated drawing surface embedded inside of a view hierarchy. |
SystemUiFlags | Enumerates values returned by several types and taken as a parameter of the Android.Views.View.DispatchSystemUiVisibilityChanged, Android.Views.View.DispatchWindowSystemUiVisiblityChanged, and Android.Views.View.OnWindowSystemUiVisibilityChanged members. |
TextAlignment | Enumerates values returned by several types. |
TextDirection | Enumerates values returned by several types. |
TextureView |
java Example public class LiveCameraActivity extends Activity implements TextureView.SurfaceTextureListener { private Camera mCamera; private TextureView mTextureView; protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); mTextureView = new TextureView(this); mTextureView.setSurfaceTextureListener(this); setContentView(mTextureView); } public void onSurfaceTextureAvailable(SurfaceTexture surface, int width, int height) { mCamera = Camera.open(); try { mCamera.setPreviewTexture(surface); mCamera.startPreview(); } catch (IOException ioe) { // Something bad happened } } public void onSurfaceTextureSizeChanged(SurfaceTexture surface, int width, int height) { // Ignored, Camera does all the work for us } public boolean onSurfaceTextureDestroyed(SurfaceTexture surface) { mCamera.stopPreview(); mCamera.release(); return true; } public void onSurfaceTextureUpdated(SurfaceTexture surface) { // Invoked every time there's a new Camera preview frame } } |
TextureView+ISurfaceTextureListener | This listener can be used to be notified when the surface texture associated with this texture view is available. |
TextureView+SurfaceTextureAvailableEventArgs | Provides data for the Android.Views.TextureView.SurfaceTextureAvailable event. |
TextureView+SurfaceTextureDestroyedEventArgs | Provides data for the Android.Views.TextureView.SurfaceTextureDestroyed event. |
TextureView+SurfaceTextureSizeChangedEventArgs | Provides data for the Android.Views.TextureView.SurfaceTextureSizeChanged event. |
TextureView+SurfaceTextureUpdatedEventArgs | Provides data for the Android.Views.TextureView.SurfaceTextureUpdated event. |
TouchableRegion | Enumerates values returned by several methods of Android.Views.TouchableRegion. |
TouchDelegate | Helper class to handle situations where you want a view to have a larger touch area than its actual view bounds. |
VelocityTracker | Helper for tracking the velocity of touch events, for implementing flinging and other such gestures. |
View |
Developer GuidesFor information about using this class to develop your application's user interface, read the User Interface developer guide. |
View+AccessibilityDelegate |
Developer Guidesjava Example if (Build.VERSION.SDK_INT >= 14) { // If the API version is equal of higher than the version in // which onInitializeAccessibilityNodeInfo was introduced we // register a delegate with a customized implementation. View view = findViewById(R.id.view_id); view.setAccessibilityDelegate(new AccessibilityDelegate() { public void onInitializeAccessibilityNodeInfo(View host, AccessibilityNodeInfo info) { // Let the default implementation populate the info. super.onInitializeAccessibilityNodeInfo(host, info); // Set some other information. info.setEnabled(host.isEnabled()); } }); } |
View+ApplyWindowInsetsHandler | Documentation for this section has not yet been entered. |
View+BaseSavedState | Base class for derived classes that want to save and restore their own state in Android.Views.View.OnSaveInstanceState. |
View+CreateContextMenuEventArgs | Provides data for the Android.Views.View.ContextMenuCreated event. |
View+DragEventArgs | Provides data for the Android.Views.View.Drag event. |
View+DragShadowBuilder | Creates an image that the system displays during the drag and drop operation. |
View+FocusChangeEventArgs | Provides data for the Android.Views.View.FocusChange, and Android.Widget.SearchView.QueryTextFocusChange events. |
View+GenericMotionEventArgs | Provides data for the Android.Views.View.GenericMotion event. |
View+HoverEventArgs | Provides data for the Android.Views.View.Hover event. |
View+IOnApplyWindowInsetsListener | Documentation for this section has not yet been entered. |
View+IOnAttachStateChangeListener | Interface definition for a callback to be invoked when this view is attached or detached from its window. |
View+IOnClickListener | Interface definition for a callback to be invoked when a view is clicked. |
View+IOnCreateContextMenuListener | Interface definition for a callback to be invoked when the context menu for this view is being built. |
View+IOnDragListener | Interface definition for a callback to be invoked when a drag is being dispatched to this view. |
View+IOnFocusChangeListener | Interface definition for a callback to be invoked when the focus state of a view changed. |
View+IOnGenericMotionListener | Interface definition for a callback to be invoked when a generic motion event is dispatched to this view. |
View+IOnHoverListener | Interface definition for a callback to be invoked when a hover event is dispatched to this view. |
View+IOnKeyListener | Interface definition for a callback to be invoked when a hardware key event is dispatched to this view. |
View+IOnLayoutChangeListener | Interface definition for a callback to be invoked when the layout bounds of a view changes due to layout processing. |
View+IOnLongClickListener | Interface definition for a callback to be invoked when a view has been clicked and held. |
View+IOnSystemUiVisibilityChangeListener | Interface definition for a callback to be invoked when the status bar changes visibility. |
View+IOnTouchListener | Interface definition for a callback to be invoked when a touch event is dispatched to this view. |
View+KeyEventArgs | Provides data for the Android.Views.View.KeyPress event. |
View+LayoutChangeEventArgs | Provides data for the Android.Views.View.LayoutChange event. |
View+LongClickEventArgs | Provides data for the Android.Views.View.LongClick event. |
View+MeasureSpec | A MeasureSpec encapsulates the layout requirements passed from parent to child. |
View+SystemUiVisibilityChangeEventArgs | Provides data for the Android.Views.View.SystemUiVisibilityChange event. |
View+TouchEventArgs | Provides data for the Android.Views.View.Touch, and Android.Widget.PopupWindow.TouchIntercepted events. |
View+ViewAttachedToWindowEventArgs | Provides data for the Android.Views.View.ViewAttachedToWindow event. |
View+ViewDetachedFromWindowEventArgs | Provides data for the Android.Views.View.ViewDetachedFromWindow event. |
ViewAnimationUtils | Defines common utilities for working with View's animations. |
ViewConfiguration | Contains methods to standard constants used in the UI for timeouts, sizes, and distances. |
ViewDebug | Various debugging/tracing tools related to Android.Views.View and the view hierarchy. |
ViewDebug+CapturedViewProperty | This annotation can be used to mark fields and methods to be dumped when the view is captured. |
ViewDebug+ExportedProperty | This annotation can be used to mark fields and methods to be dumped by the view server. |
ViewDebug+FlagToString | Defines a mapping from a flag to a String. |
ViewDebug+HierarchyTraceType | Documentation for this section has not yet been entered. |
ViewDebug+IntToString | Defines a mapping from an int value to a String. |
ViewDebug+RecyclerTraceType | Documentation for this section has not yet been entered. |
ViewGroup |
Developer Guidesjava Example import android.content.Context; import android.content.res.TypedArray; import android.util.AttributeSet; import android.view.Gravity; import android.view.View; import android.view.ViewGroup; import android.widget.RemoteViews; /** * Example of writing a custom layout manager. This is a fairly full-featured * layout manager that is relatively general, handling all layout cases. You * can simplify it for more specific cases. */ @RemoteViews.RemoteView public class CustomLayout extends ViewGroup { /** The amount of space used by children in the left gutter. */ private int mLeftWidth; /** The amount of space used by children in the right gutter. */ private int mRightWidth; /** These are used for computing child frames based on their gravity. */ private final Rect mTmpContainerRect = new Rect(); private final Rect mTmpChildRect = new Rect(); public CustomLayout(Context context) { super(context); } public CustomLayout(Context context, AttributeSet attrs) { this(context, attrs, 0); } public CustomLayout(Context context, AttributeSet attrs, int defStyle) { super(context, attrs, defStyle); } /** * Any layout manager that doesn't scroll will want this. */ @Override public boolean shouldDelayChildPressedState() { return false; } /** * Ask all children to measure themselves and compute the measurement of this * layout based on the children. */ @Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { int count = getChildCount(); // These keep track of the space we are using on the left and right for // views positioned there; we need member variables so we can also use // these for layout later. mLeftWidth = 0; mRightWidth = 0; // Measurement will ultimately be computing these values. int maxHeight = 0; int maxWidth = 0; int childState = 0; // Iterate through all children, measuring them and computing our dimensions // from their size. for (int i = 0; i < count; i++) { final View child = getChildAt(i); if (child.getVisibility() != GONE) { // Measure the child. measureChildWithMargins(child, widthMeasureSpec, 0, heightMeasureSpec, 0); // Update our size information based on the layout params. Children // that asked to be positioned on the left or right go in those gutters. final LayoutParams lp = (LayoutParams) child.getLayoutParams(); if (lp.position == LayoutParams.POSITION_LEFT) { mLeftWidth += Math.max(maxWidth, child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin); } else if (lp.position == LayoutParams.POSITION_RIGHT) { mRightWidth += Math.max(maxWidth, child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin); } else { maxWidth = Math.max(maxWidth, child.getMeasuredWidth() + lp.leftMargin + lp.rightMargin); } maxHeight = Math.max(maxHeight, child.getMeasuredHeight() + lp.topMargin + lp.bottomMargin); childState = combineMeasuredStates(childState, child.getMeasuredState()); } } // Total width is the maximum width of all inner children plus the gutters. maxWidth += mLeftWidth + mRightWidth; // Check against our minimum height and width maxHeight = Math.max(maxHeight, getSuggestedMinimumHeight()); maxWidth = Math.max(maxWidth, getSuggestedMinimumWidth()); // Report our final dimensions. setMeasuredDimension(resolveSizeAndState(maxWidth, widthMeasureSpec, childState), resolveSizeAndState(maxHeight, heightMeasureSpec, childState << MEASURED_HEIGHT_STATE_SHIFT)); } /** * Position all children within this layout. */ @Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) { final int count = getChildCount(); // These are the far left and right edges in which we are performing layout. int leftPos = getPaddingLeft(); int rightPos = right - left - getPaddingRight(); // This is the middle region inside of the gutter. final int middleLeft = leftPos + mLeftWidth; final int middleRight = rightPos - mRightWidth; // These are the top and bottom edges in which we are performing layout. final int parentTop = getPaddingTop(); final int parentBottom = bottom - top - getPaddingBottom(); for (int i = 0; i < count; i++) { final View child = getChildAt(i); if (child.getVisibility() != GONE) { final LayoutParams lp = (LayoutParams) child.getLayoutParams(); final int width = child.getMeasuredWidth(); final int height = child.getMeasuredHeight(); // Compute the frame in which we are placing this child. if (lp.position == LayoutParams.POSITION_LEFT) { mTmpContainerRect.left = leftPos + lp.leftMargin; mTmpContainerRect.right = leftPos + width + lp.rightMargin; leftPos = mTmpContainerRect.right; } else if (lp.position == LayoutParams.POSITION_RIGHT) { mTmpContainerRect.right = rightPos - lp.rightMargin; mTmpContainerRect.left = rightPos - width - lp.leftMargin; rightPos = mTmpContainerRect.left; } else { mTmpContainerRect.left = middleLeft + lp.leftMargin; mTmpContainerRect.right = middleRight - lp.rightMargin; } mTmpContainerRect.top = parentTop + lp.topMargin; mTmpContainerRect.bottom = parentBottom - lp.bottomMargin; // Use the child's gravity and size to determine its final // frame within its container. Gravity.apply(lp.gravity, width, height, mTmpContainerRect, mTmpChildRect); // Place the child. child.layout(mTmpChildRect.left, mTmpChildRect.top, mTmpChildRect.right, mTmpChildRect.bottom); } } } // ---------------------------------------------------------------------- // The rest of the implementation is for custom per-child layout parameters. // If you do not need these (for example you are writing a layout manager // that does fixed positioning of its children), you can drop all of this. @Override public LayoutParams generateLayoutParams(AttributeSet attrs) { return new CustomLayout.LayoutParams(getContext(), attrs); } @Override protected LayoutParams generateDefaultLayoutParams() { return new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT); } @Override protected ViewGroup.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p) { return new LayoutParams(p); } @Override protected boolean checkLayoutParams(ViewGroup.LayoutParams p) { return p instanceof LayoutParams; } /** * Custom per-child layout information. */ public static class LayoutParams extends MarginLayoutParams { /** * The gravity to apply with the View to which these layout parameters * are associated. */ public int gravity = Gravity.TOP | Gravity.START; public static int POSITION_MIDDLE = 0; public static int POSITION_LEFT = 1; public static int POSITION_RIGHT = 2; public int position = POSITION_MIDDLE; public LayoutParams(Context c, AttributeSet attrs) { super(c, attrs); // Pull the layout param values from the layout XML during // inflation. This is not needed if you don't care about // changing the layout behavior in XML. TypedArray a = c.obtainStyledAttributes(attrs, R.styleable.CustomLayoutLP); gravity = a.getInt(R.styleable.CustomLayoutLP_android_layout_gravity, gravity); position = a.getInt(R.styleable.CustomLayoutLP_layout_position, position); a.recycle(); } public LayoutParams(int width, int height) { super(width, height); } public LayoutParams(ViewGroup.LayoutParams source) { super(source); } } } xml Example <declare-styleable name="CustomLayoutLP"> <attr name="android:layout_gravity" /> <attr name="layout_position"> <enum name="middle" value="0" /> <enum name="left" value="1" /> <enum name="right" value="2" /> </attr> </declare-styleable> xml Example <com.example.android.apis.view.CustomLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res/com.example.android.apis" android:layout_width="match_parent" android:layout_height="match_parent"> <!-- put first view to left. --> <TextView android:background="@drawable/filled_box" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_position="left" android:layout_gravity="fill_vertical|center_horizontal" android:text="l1"/> <!-- stack second view to left. --> <TextView android:background="@drawable/filled_box" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_position="left" android:layout_gravity="fill_vertical|center_horizontal" android:text="l2"/> <!-- also put a view on the right. --> <TextView android:background="@drawable/filled_box" android:layout_width="wrap_content" android:layout_height="wrap_content" app:layout_position="right" android:layout_gravity="fill_vertical|center_horizontal" android:text="r1"/> <!-- by default views go in the middle; use fill vertical gravity --> <TextView android:background="@drawable/green" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="fill_vertical|center_horizontal" android:text="fill-vert"/> <!-- by default views go in the middle; use fill horizontal gravity --> <TextView android:background="@drawable/green" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_vertical|fill_horizontal" android:text="fill-horiz"/> <!-- by default views go in the middle; use top-left gravity --> <TextView android:background="@drawable/blue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="top|left" android:text="top-left"/> <!-- by default views go in the middle; use center gravity --> <TextView android:background="@drawable/blue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center" android:text="center"/> <!-- by default views go in the middle; use bottom-right --> <TextView android:background="@drawable/blue" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="bottom|right" android:text="bottom-right"/> </com.example.android.apis.view.CustomLayout> |
ViewGroup+ChildViewAddedEventArgs | Provides data for the Android.Views.ViewGroup.ChildViewAdded event. |
ViewGroup+ChildViewRemovedEventArgs | Provides data for the Android.Views.ViewGroup.ChildViewRemoved event. |
ViewGroup+IOnHierarchyChangeListener | Interface definition for a callback to be invoked when the hierarchy within this view changed. |
ViewGroup+LayoutParams | LayoutParams are used by views to tell their parents how they want to be laid out. |
ViewGroup+MarginLayoutParams | Per-child layout information for layouts that support margins. |
ViewGroupOverlay | A group overlay is an extra layer that sits on top of a ViewGroup (the "host view") which is drawn after all other content in that view (including the view group's children). |
ViewLayoutMode | Enumerates values returned by several types. |
ViewOutlineProvider | Interface by which a View builds its Android.Graphics.Outline, used for shadow casting and clipping. |
ViewOverlay | An overlay is an extra layer that sits on top of a View (the "host view") which is drawn after all other content in that view (including children, if the view is a ViewGroup). |
ViewPropertyAnimator | This class enables automatic and optimized animation of select properties on View objects. |
ViewStates | Enumerates values returned by several types and taken as a parameter of several types. |
ViewStub | A ViewStub is an invisible, zero-sized View that can be used to lazily inflate layout resources at runtime. |
ViewStub+InflateEventArgs | Provides data for the Android.Views.ViewStub.InflateEvent event. |
ViewStub+IOnInflateListener | Listener used to receive a notification after a ViewStub has successfully inflated its layout resource. |
ViewTreeObserver | A view tree observer is used to register listeners that can be notified of global changes in the view tree. |
ViewTreeObserver+GlobalFocusChangeEventArgs | Provides data for the Android.Views.ViewTreeObserver.GlobalFocusChange event. |
ViewTreeObserver+IOnDrawListener | Interface definition for a callback to be invoked when the view tree is about to be drawn. |
ViewTreeObserver+IOnGlobalFocusChangeListener | Interface definition for a callback to be invoked when the focus state within the view tree changes. |
ViewTreeObserver+IOnGlobalLayoutListener | Interface definition for a callback to be invoked when the global layout state or the visibility of views within the view tree changes. |
ViewTreeObserver+IOnPreDrawListener | Interface definition for a callback to be invoked when the view tree is about to be drawn. |
ViewTreeObserver+IOnScrollChangedListener | Interface definition for a callback to be invoked when something in the view tree has been scrolled. |
ViewTreeObserver+IOnTouchModeChangeListener | Interface definition for a callback to be invoked when the touch mode changes. |
ViewTreeObserver+IOnWindowAttachListener | Interface definition for a callback to be invoked when the view hierarchy is attached to and detached from its window. |
ViewTreeObserver+IOnWindowFocusChangeListener | Interface definition for a callback to be invoked when the view hierarchy's window focus state changes. |
ViewTreeObserver+PreDrawEventArgs | Provides data for the Android.Views.ViewTreeObserver.PreDraw event. |
ViewTreeObserver+TouchModeChangeEventArgs | Provides data for the Android.Views.ViewTreeObserver.TouchModeChange event. |
ViewTreeObserver+WindowFocusChangeEventArgs | Provides data for the Android.Views.ViewTreeObserver.WindowFocusChange event. |
Window | Abstract base class for a top-level window look and behavior policy. |
Window+ICallback | API from a Window back to its caller. |
WindowAnimationFrameStats | This class contains window animation frame statistics. |
WindowAnimationFrameStats+InterfaceConsts | Documentation for this section has not yet been entered. |
WindowContentFrameStats | This class contains window content frame statistics. |
WindowContentFrameStats+InterfaceConsts | Documentation for this section has not yet been entered. |
WindowFeatures | Enumerates values returned by several methods of Android.Views.WindowFeatures and taken as a parameter of several types. |
WindowId | Safe identifier for a window. |
WindowId+FocusObserver | Subclass for observing changes to the focus state of an Android.Views.WindowId. |
WindowId+InterfaceConsts | Documentation for this section has not yet been entered. |
WindowInsets | Describes a set of insets for window content. |
WindowManagerBadTokenException | Exception that is thrown when trying to add view whose Android.Views.WindowManagerLayoutParamsAndroid.Views.WindowManagerLayoutParams.Token is invalid. |
WindowManagerEventType | Enumerates values returned by several types. |
WindowManagerFlags | Enumerates values returned by several types and taken as a parameter of several types. |
WindowManagerInvalidDisplayException | Exception that is thrown when calling Android.Views.IViewManager.AddView(Android.Views.View, .LayoutParams) to a secondary display that cannot be found. |
WindowManagerLayoutParams | [Android Documentation] |
WindowManagerLayoutParams+InterfaceConsts | Documentation for this section has not yet been entered. |
WindowManagerTypes | Enumerates values returned by several types and taken as a parameter of several types. |
WindowProgress | Enumerates values returned by several types. |
WindowRotationAnimation | Enumerates values returned by several types. |