http://www.android-doc.com/reference/android/widget/LinearLayout.html
public class
LinearLayout
extends ViewGroup
java.lang.Object | |||
↳ | android.view.View | ||
↳ | android.view.ViewGroup | ||
↳ | android.widget.LinearLayout |
Known Direct Subclasses NumberPicker, RadioGroup, SearchView, TabWidget, TableLayout, TableRow, ZoomControls |
XML Attributes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Attribute Name | Related Method | Description | |||||||||
android:baselineAligned | setBaselineAligned(boolean) | When set to false, prevents the layout from aligning its children's baselines. | |||||||||
android:baselineAlignedChildIndex | setBaselineAlignedChildIndex(int) | When a linear layout is part of another layout that is baseline aligned, it can specify which of its children to baseline align to (that is, which child TextView). | |||||||||
android:divider | setDividerDrawable(Drawable) | Drawable to use as a vertical divider between buttons. | |||||||||
android:gravity | setGravity(int) | Specifies how an object should position its content, on both the X and Y axes, within its own bounds. | |||||||||
android:measureWithLargestChild | setMeasureWithLargestChildEnabled(boolean) | When set to true, all children with a weight will be considered having the minimum size of the largest child. | |||||||||
android:orientation | setOrientation(int) | Should the layout be a column or a row? Use "horizontal" for a row, "vertical" for a column. | |||||||||
android:weightSum | Defines the maximum weight sum. |
[Expand] Inherited XML Attributes |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class android.view.ViewGroup | |||||||||||
From class android.view.View |
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 |
[Expand] Inherited Constants |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class android.view.ViewGroup | |||||||||||
From class android.view.View |
[Expand] Inherited Fields |
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class android.view.View |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
LinearLayout(Context context) | |||||||||||
LinearLayout(Context context, AttributeSet attrs) | |||||||||||
LinearLayout(Context context, AttributeSet attrs, int defStyle) |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
LinearLayout.LayoutParams | generateLayoutParams(AttributeSet attrs) Returns a new set of layout parameters based on the supplied attributes set. |
||||||||||
int | getBaseline() Return the offset of the widget's text baseline from the widget's top boundary. |
||||||||||
int | getBaselineAlignedChildIndex() | ||||||||||
Drawable | getDividerDrawable() | ||||||||||
int | getDividerPadding() Get the padding size used to inset dividers in pixels |
||||||||||
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) Initializes an |
||||||||||
void | onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) Initializes an |
||||||||||
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() Return true if the pressed state should be delayed for children or descendants of this ViewGroup. |