Grid
class Grid : VirtualLayout
| kotlin.Any | ||||
| ↳ | 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 |
|
|---|---|
const Int |
HORIZONTAL = 0 |
const Int |
VERTICAL = 1 |
Public constructors |
|---|
Grid(context: Context!, attrs: AttributeSet!) |
Grid(context: Context!, attrs: AttributeSet!, defStyleAttr: Int) |
Public functions |
|
|---|---|
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 |
Unit |
|
Unit |
Visualize the boxViews that are used to constraint widgets. |
Unit |
setColumnWeights(columnWeights: String!)set new columnWeights value and also invoke invalidate |
Unit |
setColumns(columns: Int)set new columns value and also invoke initVariables and invalidate |
Unit |
setHorizontalGaps(horizontalGaps: Float)set new horizontalGaps value and also invoke invalidate |
Unit |
setOrientation(orientation: Int)set new orientation value and also invoke invalidate |
Unit |
setRowWeights(rowWeights: String!)set new rowWeights value and also invoke invalidate |
Unit |
set new rows value and also invoke initVariables and invalidate |
Unit |
set new skips value and also invoke invalidate |
Unit |
setSpans(spans: CharSequence!)set new spans value and also invoke invalidate |
Unit |
setVerticalGaps(verticalGaps: Float)set new verticalGaps value and also invoke invalidate |
Protected functions |
|
|---|---|
Unit |
init(attrs: AttributeSet!) |
Inherited Constants |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Inherited properties |
|---|
Constants
Public constructors
Public functions
getColumnWeights
fun getColumnWeights(): String!
get the string value of columnWeights
| Returns | |
|---|---|
String! |
the string value of columnWeights |
getColumns
fun getColumns(): Int
get the value of columns
| Returns | |
|---|---|
Int |
the value of columns |
getHorizontalGaps
fun getHorizontalGaps(): Float
get the value of horizontalGaps
| Returns | |
|---|---|
Float |
the value of horizontalGaps |
getOrientation
fun getOrientation(): Int
get the value of orientation
| Returns | |
|---|---|
Int |
the value of orientation |
getRowWeights
fun getRowWeights(): String!
get the string value of rowWeights
| Returns | |
|---|---|
String! |
the string value of rowWeights |
getSkips
fun getSkips(): String!
get the string value of skips
| Returns | |
|---|---|
String! |
the string value of skips |
getSpans
fun getSpans(): String!
get the string value of spans
| Returns | |
|---|---|
String! |
the string value of spans |
getVerticalGaps
fun getVerticalGaps(): Float
get the value of verticalGaps
| Returns | |
|---|---|
Float |
the value of verticalGaps |
onDraw
fun onDraw(canvas: Canvas): Unit
Visualize the boxViews that are used to constraint widgets.
| Parameters | |
|---|---|
canvas: Canvas |
canvas to visualize the boxViews |
setColumnWeights
fun setColumnWeights(columnWeights: String!): Unit
set new columnWeights value and also invoke invalidate
| Parameters | |
|---|---|
columnWeights: String! |
new columnWeights value |
setColumns
fun setColumns(columns: Int): Unit
set new columns value and also invoke initVariables and invalidate
| Parameters | |
|---|---|
columns: Int |
new rows value |
setHorizontalGaps
fun setHorizontalGaps(horizontalGaps: Float): Unit
set new horizontalGaps value and also invoke invalidate
| Parameters | |
|---|---|
horizontalGaps: Float |
new horizontalGaps value |
setOrientation
fun setOrientation(orientation: Int): Unit
set new orientation value and also invoke invalidate
| Parameters | |
|---|---|
orientation: Int |
new orientation value |
setRowWeights
fun setRowWeights(rowWeights: String!): Unit
set new rowWeights value and also invoke invalidate
| Parameters | |
|---|---|
rowWeights: String! |
new rowWeights value |
setRows
fun setRows(rows: Int): Unit
set new rows value and also invoke initVariables and invalidate
| Parameters | |
|---|---|
rows: Int |
new rows value |
setSkips
fun setSkips(skips: String!): Unit
set new skips value and also invoke invalidate
| Parameters | |
|---|---|
skips: String! |
new spans value |
setSpans
fun setSpans(spans: CharSequence!): Unit
set new spans value and also invoke invalidate
| Parameters | |
|---|---|
spans: CharSequence! |
new spans value |
setVerticalGaps
fun setVerticalGaps(verticalGaps: Float): Unit
set new verticalGaps value and also invoke invalidate
| Parameters | |
|---|---|
verticalGaps: Float |
new verticalGaps value |