Java android.widget RelativeLayout fields, constructors, methods, implement or subclass

Example usage for Java android.widget RelativeLayout fields, constructors, methods, implement or subclass

Introduction

In this page you can find the methods, fields and constructors for android.widget RelativeLayout.

The text is from its open source code.

Subclass

android.widget.RelativeLayout has subclasses.
Click this link to see all its subclasses.

Field

intTRUE
intLEFT_OF
Rule that aligns a child's right edge with another child's left edge.
intRIGHT_OF
Rule that aligns a child's left edge with another child's right edge.
intABOVE
Rule that aligns a child's bottom edge with another child's top edge.
intBELOW
Rule that aligns a child's top edge with another child's bottom edge.
intALIGN_BASELINE
Rule that aligns a child's baseline with another child's baseline.
intALIGN_LEFT
Rule that aligns a child's left edge with another child's left edge.
intALIGN_TOP
Rule that aligns a child's top edge with another child's top edge.
intALIGN_RIGHT
Rule that aligns a child's right edge with another child's right edge.
intALIGN_BOTTOM
Rule that aligns a child's bottom edge with another child's bottom edge.
intALIGN_PARENT_LEFT
Rule that aligns the child's left edge with its RelativeLayout parent's left edge.
intALIGN_PARENT_TOP
Rule that aligns the child's top edge with its RelativeLayout parent's top edge.
intALIGN_PARENT_RIGHT
Rule that aligns the child's right edge with its RelativeLayout parent's right edge.
intALIGN_PARENT_BOTTOM
Rule that aligns the child's bottom edge with its RelativeLayout parent's bottom edge.
intCENTER_IN_PARENT
Rule that centers the child with respect to the bounds of its RelativeLayout parent.
intCENTER_HORIZONTAL
Rule that centers the child horizontally with respect to the bounds of its RelativeLayout parent.
intCENTER_VERTICAL
Rule that centers the child vertically with respect to the bounds of its RelativeLayout parent.
intEND_OF
Rule that aligns a child's start edge with another child's end edge.
intALIGN_END
Rule that aligns a child's end edge with another child's end edge.
intALIGN_PARENT_START
Rule that aligns the child's start edge with its RelativeLayout parent's start edge.
intALIGN_PARENT_END
Rule that aligns the child's end edge with its RelativeLayout parent's end edge.

Constructor

Method

voidaddView(View child, int index)
Adds a child view.
voidaddView(View child)

Adds a child view.

voidaddView(View child, int width, int height)
Adds a child view with this ViewGroup's default layout parameters and the specified width and height.
ViewPropertyAnimatoranimate()
This method returns a ViewPropertyAnimator object, which can be used to animate specific properties on this View.
voidbringToFront()
Change the view's z order in the tree, so it's on top of other sibling views.
voiddraw(Canvas canvas)
Manually render this view (and all of its children) to the given Canvas.
TfindViewById(@IdRes int id)
Finds the first descendant view with the given ID, the view itself if the ID matches #getId() , or null if the ID is invalid (< 0) or there is no matching view in the hierarchy.
DrawablegetBackground()
Gets the background drawable
intgetBottom()
Bottom position of this view relative to its parent.
ViewgetChildAt(int index)
Returns the view at the specified position in the group.
intgetChildCount()
Returns the number of children in the group.
ContextgetContext()
Returns the context the view is running in, through which it can access the current theme, resources, etc.
booleangetGlobalVisibleRect(Rect r)
intgetHeight()
Return the height of your view.
intgetId()
Returns this view's identifier.
ViewGroup.LayoutParamsgetLayoutParams()
Get the LayoutParams associated with this view.
voidgetLocationInWindow(@Size(2) int[] outLocation)

Computes the coordinates of this view in its window.

intgetMeasuredHeight()
Like #getMeasuredHeightAndState() , but only returns the raw height component (that is the result is masked by #MEASURED_SIZE_MASK ).
intgetMeasuredWidth()
Like #getMeasuredWidthAndState() , but only returns the raw width component (that is the result is masked by #MEASURED_SIZE_MASK ).
ResourcesgetResources()
Returns the resources associated with this view.
ObjectgetTag()
Returns this view's tag.
intgetTop()
Top position of this view relative to its parent.
ViewTreeObservergetViewTreeObserver()
Returns the ViewTreeObserver for this view's hierarchy.
intgetVisibility()
Returns the visibility status for this view.
intgetWidth()
Return the width of your view.
IBindergetWindowToken()
Retrieve a unique token identifying the window this view is attached to.
floatgetY()
The visual y position of this view, in pixels.
voidinvalidate()
Invalidate the whole view.
voidlayout(int l, int t, int r, int b)
voidmeasure(int widthMeasureSpec, int heightMeasureSpec)

This is called to find out how big a view should be.

booleanpostDelayed(Runnable action, long delayMillis)

Causes the Runnable to be added to the message queue, to be run after the specified amount of time elapses.

voidremoveAllViews()
Call this method to remove all child views from the ViewGroup.
voidremoveView(View view)

Note: do not invoke this method from #draw(android.graphics.Canvas) , #onDraw(android.graphics.Canvas) , #dispatchDraw(android.graphics.Canvas) or any related method.

voidremoveViewAt(int index)
Removes the view at the specified position in the group.
booleanrequestFocus()
Call this to try to give focus to a specific view or to one of its descendants.
voidrequestLayout()
voidsetAlpha(@FloatRange(from = 0.0, to = 1.0) float alpha)
Sets the opacity of the view to a value from 0 to 1, where 0 means the view is completely transparent and 1 means the view is completely opaque.
voidsetBackground(Drawable background)
Set the background to a given Drawable, or remove the background.
voidsetBackgroundColor(@ColorInt int color)
Sets the background color for this view.
voidsetBackgroundDrawable(Drawable background)
voidsetBackgroundResource(@DrawableRes int resid)
Set the background to a given resource.
voidsetClickable(boolean clickable)
Enables or disables click events for this view.
voidsetEnabled(boolean enabled)
Set the enabled state of this view.
voidsetFocusable(boolean focusable)
Set whether this view can receive the focus.
voidsetFocusableInTouchMode(boolean focusableInTouchMode)
Set whether this view can receive focus while in touch mode.
voidsetGravity(int gravity)
Describes how the child views are positioned.
voidsetHorizontalGravity(int horizontalGravity)
voidsetId(@IdRes int id)
Sets the identifier for this view.
voidsetLayoutParams(ViewGroup.LayoutParams params)
Set the layout parameters associated with this view.
voidsetLayoutTransition(LayoutTransition transition)
Sets the LayoutTransition object for this ViewGroup.
voidsetOnClickListener(@Nullable OnClickListener l)
Register a callback to be invoked when this view is clicked.
voidsetOnDragListener(OnDragListener l)
Register a drag event listener callback object for this View.
voidsetOnLongClickListener(@Nullable OnLongClickListener l)
Register a callback to be invoked when this view is clicked and held.
voidsetOnTouchListener(OnTouchListener l)
Register a callback to be invoked when a touch event is sent to this view.
voidsetPadding(int left, int top, int right, int bottom)
Sets the padding.
voidsetSaveEnabled(boolean enabled)
Controls whether the saving of this view's state is enabled (that is, whether its #onSaveInstanceState method will be called).
voidsetScaleX(float scaleX)
Sets the amount that the view is scaled in x around the pivot point, as a proportion of the view's unscaled width.
voidsetScaleY(float scaleY)
Sets the amount that the view is scaled in Y around the pivot point, as a proportion of the view's unscaled width.
voidsetSelected(boolean selected)
Changes the selection state of this view.
voidsetTag(final Object tag)
Sets the tag associated with this view.
voidsetTag(int key, final Object tag)
Sets a tag associated with this view and a key.
voidsetVerticalGravity(int verticalGravity)
voidsetVisibility(@Visibility int visibility)
Set the visibility state of this view.
voidsetY(float y)
Sets the visual y position of this view, in pixels.
voidstartAnimation(Animation animation)
Start the specified animation now.
voidupdateViewLayout(View view, ViewGroup.LayoutParams params)