Grid
public class Grid extends VirtualLayout
| java.lang.Object | ||||
| ↳ | android.view.View | |||
| ↳ | androidx.constraintlayout.widget.ConstraintHelper | |||
| ↳ | androidx.constraintlayout.widget.VirtualLayout | |||
| ↳ | androidx.constraintlayout.helper.widget.Grid |
A helper class that helps arrange widgets in a grid form
Grid
| Attributes | Description |
|---|---|
| grid_rows | Indicates the number of rows will be created for the grid form. |
| grid_columns | Indicates the number of columns will be created for the grid form. |
| grid_rowWeights | Specifies the weight of each row in the grid form (default value is 1). |
| grid_columnWeights | Specifies the weight of each column in the grid form (default value is 1). |
| grid_spans | Offers the capability to span a widget across multiple rows and columns |
| grid_skips | Enables skip certain positions in the grid and leave them empty |
| grid_orientation | Defines how the associated widgets will be arranged - vertically or horizontally |
| grid_horizontalGaps | Adds margin horizontally between widgets |
| grid_verticalGaps | Adds margin vertically between widgets |
Summary
Constants |
|
|---|---|
static final int |
HORIZONTAL = 0 |
static final int |
VERTICAL = 1 |
Public constructors |
|---|
Grid(Context context, AttributeSet attrs) |
Grid(Context context, AttributeSet attrs, int defStyleAttr) |
Public methods |
|
|---|---|
String |
get the string value of columnWeights |
int |
get the value of columns |
float |
get the value of horizontalGaps |
int |
get the value of orientation |
String |
get the string value of rowWeights |
int |
getRows()get the value of rows |
String |
getSkips()get the string value of skips |
String |
getSpans()get the string value of spans |
float |
get the value of verticalGaps |
void |
|
void |
Visualize the boxViews that are used to constraint widgets. |
void |
setColumnWeights(String columnWeights)set new columnWeights value and also invoke invalidate |
void |
setColumns(int columns)set new columns value and also invoke initVariables and invalidate |
void |
setHorizontalGaps(float horizontalGaps)set new horizontalGaps value and also invoke invalidate |
void |
setOrientation(int orientation)set new orientation value and also invoke invalidate |
void |
setRowWeights(String rowWeights)set new rowWeights value and also invoke invalidate |
void |
setRows(int rows)set new rows value and also invoke initVariables and invalidate |
void |
set new skips value and also invoke invalidate |
void |
setSpans(CharSequence spans)set new spans value and also invoke invalidate |
void |
setVerticalGaps(float verticalGaps)set new verticalGaps value and also invoke invalidate |
Protected methods |
|
|---|---|
void |
init(AttributeSet attrs) |
Inherited Constants |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Inherited methods |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Constants
Public constructors
Public methods
getColumnWeights
public String getColumnWeights()
get the string value of columnWeights
| Returns | |
|---|---|
String |
the string value of columnWeights |
getColumns
public int getColumns()
get the value of columns
| Returns | |
|---|---|
int |
the value of columns |
getHorizontalGaps
public float getHorizontalGaps()
get the value of horizontalGaps
| Returns | |
|---|---|
float |
the value of horizontalGaps |
getOrientation
public int getOrientation()
get the value of orientation
| Returns | |
|---|---|
int |
the value of orientation |
getRowWeights
public String getRowWeights()
get the string value of rowWeights
| Returns | |
|---|---|
String |
the string value of rowWeights |
getSkips
public String getSkips()
get the string value of skips
| Returns | |
|---|---|
String |
the string value of skips |
getSpans
public String getSpans()
get the string value of spans
| Returns | |
|---|---|
String |
the string value of spans |
getVerticalGaps
public float getVerticalGaps()
get the value of verticalGaps
| Returns | |
|---|---|
float |
the value of verticalGaps |
onDraw
public void onDraw(@NonNull Canvas canvas)
Visualize the boxViews that are used to constraint widgets.
setColumnWeights
public void setColumnWeights(String columnWeights)
set new columnWeights value and also invoke invalidate
| Parameters | |
|---|---|
String columnWeights |
new columnWeights value |
setColumns
public void setColumns(int columns)
set new columns value and also invoke initVariables and invalidate
| Parameters | |
|---|---|
int columns |
new rows value |
setHorizontalGaps
public void setHorizontalGaps(float horizontalGaps)
set new horizontalGaps value and also invoke invalidate
| Parameters | |
|---|---|
float horizontalGaps |
new horizontalGaps value |
setOrientation
public void setOrientation(int orientation)
set new orientation value and also invoke invalidate
| Parameters | |
|---|---|
int orientation |
new orientation value |
setRowWeights
public void setRowWeights(String rowWeights)
set new rowWeights value and also invoke invalidate
| Parameters | |
|---|---|
String rowWeights |
new rowWeights value |
setRows
public void setRows(int rows)
set new rows value and also invoke initVariables and invalidate
| Parameters | |
|---|---|
int rows |
new rows value |
setSkips
public void setSkips(String skips)
set new skips value and also invoke invalidate
| Parameters | |
|---|---|
String skips |
new spans value |
setSpans
public void setSpans(CharSequence spans)
set new spans value and also invoke invalidate
| Parameters | |
|---|---|
CharSequence spans |
new spans value |
setVerticalGaps
public void setVerticalGaps(float verticalGaps)
set new verticalGaps value and also invoke invalidate
| Parameters | |
|---|---|
float verticalGaps |
new verticalGaps value |