public class ColumnSystem extends Object
The column system has three basic attributes: column, gutter, and margin.
| 限定符和类型 | 字段 | 说明 |
|---|---|---|
static int |
BOTTOM_SHEET_TYPE |
Indicates the column type for bottom sheets.
|
static int |
BUBBLE_TYPE |
Indicates the bubble column type.
|
static int |
CARD_DOUBLE_BUTTON_TYPE |
Indicates the double-button column type for card.
|
static int |
CARD_SINGLE_BUTTON_TYPE |
Indicates the single-button column type for card.
|
static int |
CARD_TYPE |
Indicates the card column type.
|
static int |
CONTENT_TYPE |
Indicates the content column type.
|
static int |
CUSTOM_TYPE |
Indicates a custom column type.
|
static int |
DIALOG_TYPE |
Indicates the dialog column type.
|
static int |
DOUBLE_BUTTON_TYPE |
Indicates the double-button column type.
|
static int |
LARGE_BOTTOMTAB_TYPE |
Indicates the column type for the large bottom tab (that is, a bottom tab that has more than three items).
|
static int |
LARGE_TOOLBAR_TYPE |
Indicates the column type for the large toolbar (that is, a toolbar that has four or fix items).
|
static int |
MENU_TYPE |
Indicates the menu column type.
|
static int |
SINGLE_BUTTON_TYPE |
Indicates the single-button column type.
|
static int |
SMALL_BOTTOMTAB_TYPE |
Indicates the column type for the small bottom tab (that is, a bottom tab that has three items or less).
|
static int |
SMALL_TOOLBAR_TYPE |
Indicates the column type for the small toolbar (that is, a toolbar that has two or three items).
|
static int |
TOAST_TYPE |
Indicates the toast column type.
|
| 构造器 | 说明 |
|---|---|
ColumnSystem(Context context) |
A constructor used to create a default
ColumnSystem instance. |
ColumnSystem(Context context,
int columnType) |
Creates a
ColumnSystem instance of a specified column type. |
| 限定符和类型 | 方法 | 说明 |
|---|---|---|
int |
getColumnType() |
Obtains the column type of the current column system.
|
float |
getColumnWidth(int columnCount) |
Obtains the total width of a specified number of columns.
|
int |
getGutter() |
Obtains the gutter width of the column system.
|
int |
getMargin() |
Obtains the margin width of the column system.
|
int |
getMaxColumnWidth() |
Obtains the maximum column width of a specified column type.
|
int |
getMinColumnWidth() |
Obtains the minimum column width of a specified column type.
|
int |
getSuggestedWidth() |
Obtains the width for the current column type.
|
int |
getTotalColumnCount() |
Obtains the total number of columns in the current column system.
|
void |
setColumnType(int columnType) |
Sets the column type of the current column system.
|
int |
updateConfiguration(int width,
int height,
float density) |
Sets the effective area of the column system to partial window.
|
int |
updateConfiguration(Context context) |
Sets the effective area of the column system to complete window.
|
public static final int BOTTOM_SHEET_TYPE
public static final int BUBBLE_TYPE
public static final int CARD_DOUBLE_BUTTON_TYPE
public static final int CARD_SINGLE_BUTTON_TYPE
public static final int CARD_TYPE
public static final int CONTENT_TYPE
public static final int CUSTOM_TYPE
public static final int DIALOG_TYPE
This column type can be automatically adapted to four sub-types based on the window size and window width/height ratio:
< 12 and window width/height ratio > 9:16< 12 and window width/height ratio <= 9:16>= 12 and window width/height ratio > 9:16>= 12 and window width/height ratio <= 9:16public static final int DOUBLE_BUTTON_TYPE
public static final int LARGE_BOTTOMTAB_TYPE
public static final int LARGE_TOOLBAR_TYPE
public static final int MENU_TYPE
public static final int SINGLE_BUTTON_TYPE
public static final int SMALL_BOTTOMTAB_TYPE
public static final int SMALL_TOOLBAR_TYPE
public static final int TOAST_TYPE
public ColumnSystem(Context context)
ColumnSystem instance.context - Indicates the application context.public ColumnSystem(Context context, int columnType)
ColumnSystem instance of a specified column type.context - Indicates the application context.columnType - Indicates the column type.public int getTotalColumnCount()
public int getSuggestedWidth()
When you create a ColumnSystem instance using ColumnSystem(ohos.app.Context), the return value is the
width for the default column type. When you create a ColumnSystem instance using
ColumnSystem(ohos.app.Context,int), the return value is the width for the specified column type. For the column
type that uses a width range, for example, ColumnSystem.SINGLE_BUTTON_TYPE, the return value is the
minimum width.
public float getColumnWidth(int columnCount)
columnCount - Indicates the number of columns.6 indicates the
total width of six columns and five gutters.public int getColumnType()
public void setColumnType(int columnType)
columnType - Indicates the column type.public int getMargin()
public int getGutter()
public int getMinColumnWidth()
ColumnSystem.SINGLE_BUTTON_TYPE, uses a width range; returns a fixed value if the specified
column type uses a fixed width.public int getMaxColumnWidth()
ColumnSystem.SINGLE_BUTTON_TYPE, uses a width range; returns a fixed value if the specified
column type uses a fixed width.public int updateConfiguration(Context context)
context - Indicates the application context.public int updateConfiguration(int width,
int height,
float density)
width - Indicates the width of the effective area.height - Indicates the height of the effective area.density - Indicates the screen density of the effective area. Generally, the value of density is the same as
that on the device.