Google se compromete a impulsar la igualdad racial para las comunidades afrodescendientes. Obtén información al respecto.

LinearLayoutCompat

public class LinearLayoutCompat
extends ViewGroup

java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ androidx.appcompat.widget.LinearLayoutCompat


A Layout that arranges its children in a single column or a single row. The direction of the row can be set by calling setOrientation(). You can also specify gravity, which specifies the alignment of all the child elements by calling setGravity() or specify that specific children grow to fill up any remaining space in the layout by setting the weight member of LinearLayoutCompat.LayoutParams. The default orientation is horizontal.

See the Linear Layout guide.

Also see LinearLayoutCompat.LayoutParams for layout attributes

Summary

Nested classes

class LinearLayoutCompat.LayoutParams

Per-child layout information associated with ViewLinearLayout. 

Constants

int HORIZONTAL

int SHOW_DIVIDER_BEGINNING

Show a divider at the beginning of the group.

int SHOW_DIVIDER_END

Show a divider at the end of the group.

int SHOW_DIVIDER_MIDDLE

Show dividers between each item in the group.

int SHOW_DIVIDER_NONE

Don't show any dividers.

int VERTICAL

Inherited constants

Inherited fields

Public constructors

LinearLayoutCompat(Context context)
LinearLayoutCompat(Context context, AttributeSet attrs)
LinearLayoutCompat(Context context, AttributeSet attrs, int defStyleAttr)

Public methods

LinearLayoutCompat.LayoutParams generateLayoutParams(AttributeSet attrs)
int getBaseline()
int getBaselineAlignedChildIndex()
Drawable getDividerDrawable()
int getDividerPadding()

Get the padding size used to inset dividers in pixels

int getGravity()

Returns the current gravity.

int getOrientation()

Returns the current orientation.

int getShowDividers()
float getWeightSum()

Returns the desired weights sum.

boolean isBaselineAligned()

Indicates whether widgets contained within this layout are aligned on their baseline or not.

boolean isMeasureWithLargestChildEnabled()

When true, all children with a weight will be considered having the minimum size of the largest child.

void onInitializeAccessibilityEvent(AccessibilityEvent event)
void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info)
void setBaselineAligned(boolean baselineAligned)

Defines whether widgets contained in this layout are baseline-aligned or not.

void setBaselineAlignedChildIndex(int i)
void setDividerDrawable(Drawable divider)

Set a drawable to be used as a divider between items.

void setDividerPadding(int padding)

Set padding displayed on both ends of dividers.

void setGravity(int gravity)

Describes how the child views are positioned.

void setHorizontalGravity(int horizontalGravity)
void setMeasureWithLargestChildEnabled(boolean enabled)

When set to true, all children with a weight will be considered having the minimum size of the largest child.

void setOrientation(int orientation)

Should the layout be a column or a row.

void setShowDividers(int showDividers)

Set how dividers should be shown between items in this layout

void setVerticalGravity(int verticalGravity)
void setWeightSum(float weightSum)

Defines the desired weights sum.

boolean shouldDelayChildPressedState()

Protected methods

boolean checkLayoutParams(ViewGroup.LayoutParams p)
LinearLayoutCompat.LayoutParams generateDefaultLayoutParams()

Returns a set of layout parameters with a width of ViewGroup.LayoutParams.MATCH_PARENT and a height of ViewGroup.LayoutParams.WRAP_CONTENT when the layout's orientation is VERTICAL.

LinearLayoutCompat.LayoutParams generateLayoutParams(ViewGroup.LayoutParams p)
void onDraw(Canvas canvas)
void onLayout(boolean changed, int l, int t, int r, int b)
void onMeasure(int widthMeasureSpec, int heightMeasureSpec)

Inherited methods

Constants

HORIZONTAL

public static final int HORIZONTAL

Constant Value: 0 (0x00000000)

SHOW_DIVIDER_BEGINNING

public static final int SHOW_DIVIDER_BEGINNING

Show a divider at the beginning of the group.

Constant Value: 1 (0x00000001)

SHOW_DIVIDER_END

public static final int SHOW_DIVIDER_END

Show a divider at the end of the group.

Constant Value: 4 (0x00000004)

SHOW_DIVIDER_MIDDLE

public static final int SHOW_DIVIDER_MIDDLE

Show dividers between each item in the group.

Constant Value: 2 (0x00000002)

SHOW_DIVIDER_NONE

public static final int SHOW_DIVIDER_NONE

Don't show any dividers.

Constant Value: 0 (0x00000000)

VERTICAL

public static final int VERTICAL

Constant Value: 1 (0x00000001)

Public constructors

LinearLayoutCompat

public LinearLayoutCompat (Context context)

Parameters
context Context

LinearLayoutCompat

public LinearLayoutCompat (Context context, 
                AttributeSet attrs)

Parameters
context Context

attrs AttributeSet

LinearLayoutCompat

public LinearLayoutCompat (Context context, 
                AttributeSet attrs, 
                int defStyleAttr)

Parameters
context Context