鴻蒙OS DirectionalLayout.LayoutConfig

2022-09-22 09:47 更新

DirectionalLayout.LayoutConfig

java.lang.Object

|---ohos.agp.components.ComponentContainer.LayoutConfig

|---|---ohos.agp.components.DirectionalLayout.LayoutConfig

  1. public static class DirectionalLayout.LayoutConfig
  2. extends ComponentContainer.LayoutConfig

指定子控件的布局參數(shù)。

字段摘要

修飾符和類型 字段 描述
int alignment 表示子組件的對齊方式。
static int UNSPECIFIED_ALIGNMENT 表示尚未設置的對齊值。
static float UNSPECIFIED_WEIGHT 表示尚未設置的權重。
float weight 表示子組件的權重。
從類 ohos.agp.components.ComponentContainer.LayoutConfig 繼承的字段
height, MATCH_CONTENT, MATCH_PARENT, width

構造函數(shù)摘要

構造函數(shù) 描述
LayoutConfig() 默認構造函數(shù)用于創(chuàng)建 LayoutConfig 實例,其寬度和高度默認設置為 ComponentContainer.LayoutConfig#MATCH_CONTENT。
LayoutConfig(int width, int height) 用于根據(jù)指定的寬度和高度創(chuàng)建 LayoutConfig 實例的構造函數(shù)。
LayoutConfig(int width, int height, int alignment, float weight) 用于根據(jù)指定的寬度、高度、對齊方式和權重創(chuàng)建 LayoutConfig 實例的構造函數(shù)。
LayoutConfig(ComponentContainer.LayoutConfig source) 用于根據(jù)源布局的寬度和高度設置布局參數(shù)的構造函數(shù)。
LayoutConfig(DirectionalLayout.LayoutConfig source) 用于根據(jù)源布局的寬度、高度、邊距、對齊方式和粗細設置布局參數(shù)的構造函數(shù)。
LayoutConfig(Context context, AttrSet attrSet) 用于根據(jù)上下文和屬性集創(chuàng)建 LayoutConfig 實例的構造函數(shù)。

方法總結

從類 ohos.agp.components.ComponentContainer.LayoutConfig 繼承的方法
clone, getHorizontalEndMargin, getHorizontalStartMargin, getLayoutDirection, getMarginBottom, getMarginLeft, getMarginRight, getMargins, getMarginsLeftAndRight, getMarginsTopAndBottom, getMarginTop, isMarginsRelative, setMarginBottom, setMarginLeft, setMarginRight, setMargins, setMarginsLeftAndRight, setMarginsRelative, setMarginsTopAndBottom, setMarginTop
從類 java.lang.Object 繼承的方法
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

字段詳細信息

UNSPECIFIED_ALIGNMENT

public static final int UNSPECIFIED_ALIGNMENT

表示尚未設置的對齊值。

UNSPECIFIED_WEIGHT

public static final float UNSPECIFIED_WEIGHT

表示尚未設置的權重。

alignment

public int alignment

表示子組件的對齊方式。

weight

public float weight

表示子組件的權重。

構造函數(shù)詳細信息

LayoutConfig

public LayoutConfig()

默認構造函數(shù)用于創(chuàng)建 LayoutConfig 實例,其寬度和高度默認設置為 ComponentContainer.LayoutConfig#MATCH_CONTENT。

LayoutConfig

public LayoutConfig(Context context, AttrSet attrSet)

用于根據(jù)上下文和屬性集創(chuàng)建 LayoutConfig 實例的構造函數(shù)。

參數(shù):

參數(shù)名稱 參數(shù)描述
context 指示應用程序上下文。
attrSet 指示要使用的屬性集。

LayoutConfig

public LayoutConfig(int width, int height)

用于根據(jù)指定的寬度和高度創(chuàng)建 LayoutConfig 實例的構造函數(shù)。

參數(shù):

參數(shù)名稱 參數(shù)描述
width 指定寬度,可以是特定值,也可以是 ComponentContainer.LayoutConfig.MATCH_PARENT 或 ComponentContainer.LayoutConfig.MATCH_CONTENT。
height 指定高度,可以是特定值,也可以是 ComponentContainer.LayoutConfig.MATCH_PARENT 或 ComponentContainer.LayoutConfig.MATCH_CONTENT。

LayoutConfig

public LayoutConfig(int width, int height, int alignment, float weight)

用于根據(jù)指定的寬度、高度、對齊方式和權重創(chuàng)建 LayoutConfig 實例的構造函數(shù)。

參數(shù):

參數(shù)名稱 參數(shù)描述
width 指定寬度,可以是特定值,也可以是 ComponentContainer.LayoutConfig.MATCH_PARENT 或 ComponentContainer.LayoutConfig.MATCH_CONTENT。
height 指定高度,可以是特定值,也可以是 ComponentContainer.LayoutConfig.MATCH_PARENT 或 ComponentContainer.LayoutConfig.MATCH_CONTENT。
alignment 指定對齊值。
weight 指定權重值。

LayoutConfig

public LayoutConfig(ComponentContainer.LayoutConfig source)

用于根據(jù)源布局的寬度和高度設置布局參數(shù)的構造函數(shù)。 邊距、對齊方式和權重設置為默認值。

參數(shù):

參數(shù)名稱 參數(shù)描述
source 指定源布局的參數(shù)。

LayoutConfig

public LayoutConfig(DirectionalLayout.LayoutConfig source)

用于根據(jù)源布局的寬度、高度、邊距、對齊方式和粗細設置布局參數(shù)的構造函數(shù)。

參數(shù):

參數(shù)名稱 參數(shù)描述
source 指定源布局的參數(shù)。
以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號