新聞中心
MagicLayout.LayoutConfig

成都創(chuàng)新互聯(lián)主要從事成都做網(wǎng)站、成都網(wǎng)站設計、成都外貿(mào)網(wǎng)站建設、網(wǎng)頁設計、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務。立足成都服務武平,十余年網(wǎng)站建設經(jīng)驗,價格優(yōu)惠、服務專業(yè),歡迎來電咨詢建站服務:18982081108
java.lang.Object
|---ohos.agp.components.ComponentContainer.LayoutConfig
|---|---ohos.agp.components.MagicLayout.LayoutConfig
public static class MagicLayout.LayoutConfig
extends ComponentContainer.LayoutConfig指定 MagicLayout 中組件的布局參數(shù)。
Since:
5
字段摘要
| 修飾符和類型 | 字段 | 描述 |
|---|---|---|
| int | referenceSize | 表示換行參考大小。 |
| static int | UNSPECIFIED_HIDE_PRIORITY | 表示默認隱藏優(yōu)先級。 |
| static int | UNSPECIFIED_REFERENCE_SIZE | 指示換行參考尺寸的默認值,它等于組件的寬度及其邊距。 |
| 從類 ohos.agp.components.ComponentContainer.LayoutConfig 繼承的字段 |
|---|
| height, MATCH_CONTENT, MATCH_PARENT, width |
構(gòu)造函數(shù)摘要
| 構(gòu)造函數(shù) | 描述 |
|---|---|
| LayoutConfig() | 用于創(chuàng)建 LayoutConfig 實例的默認構(gòu)造函數(shù),默認寬度和高度為 ComponentContainer.LayoutConfig#MATCH_CONTENT。 |
| LayoutConfig(int width, int height) | 用于創(chuàng)建具有指定寬度和高度的 LayoutConfig 實例的構(gòu)造函數(shù)。 |
| LayoutConfig(ComponentContainer.LayoutConfig source) | 用于創(chuàng)建 LayoutConfig 實例的構(gòu)造函數(shù),使用父布局的參數(shù)。 |
| LayoutConfig(MagicLayout.LayoutConfig source) | 用于創(chuàng)建 LayoutConfig 實例的構(gòu)造函數(shù),使用當前 MagicLayout 的參數(shù)(包括寬度、高度、填充、邊距、對齊方式和換行參考大?。?。 |
| LayoutConfig(Context context, AttrSet attrSet) | 用于創(chuàng)建具有指定應用程序上下文和屬性集的 LayoutConfig 實例的構(gòu)造函數(shù)。 |
方法總結(jié)
| 修飾符和類型 | 方法 | 描述 |
|---|---|---|
| void | applyToComponent(Component component) | |
| int | getHidePriority() | 獲取 MagicLayout 中組件的隱藏優(yōu)先級。 |
| float | getLayoutWeight() | 獲取 MagicLayout 中組件的權(quán)重。 |
| int | getMaxScaleHeight() | 獲取 MagicLayout 中縮放組件的最大高度。 |
| int | getMaxScaleWidth() | 獲取 MagicLayout 中縮放組件的最大寬度。 |
| int | getMinScaleHeight() | 獲取 MagicLayout 中縮放組件的最小高度。 |
| int | getMinScaleWidth() | 獲取 MagicLayout 中縮放組件的最小寬度。 |
| float | getScaleRatioOfParentHeight() | 獲取縮放組件的高度與其父 MagicLayout 高度的比率。 |
| float | getScaleRatioOfParentWidth() | 獲取縮放組件的寬度與其父 MagicLayout 寬度的比率。 |
| void | setHidePriority(int hidePriority) | 設置 MagicLayout 中組件的隱藏優(yōu)先級。 |
| void | setLayoutWeight(float layoutWeight) | 設置 MagicLayout 中組件的權(quán)重。 |
| void | setMaxScaleHeight(int maxScaleHeight) | 設置 MagicLayout 中縮放組件的最大高度。 |
| void | setMaxScaleWidth(int maxScaleWidth) | 設置 MagicLayout 中縮放組件的最大寬度。 |
| void | setMinScaleHeight(int minScaleHeight) | 設置 MagicLayout 中縮放組件的最小高度。 |
| void | setMinScaleWidth(int minScaleWidth) | 設置 MagicLayout 中縮放組件的最小寬度。 |
| void | setScaleRatioOfParentHeight(float heightRatio) | 設置縮放組件的高度與其父 MagicLayout 高度的比率。 |
| void | setScaleRatioOfParentWidth(float widthRatio) | 設置縮放組件的寬度與其父 MagicLayout 的寬度的比率。 |
| 從類 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_HIDE_PRIORITY
public static final int UNSPECIFIED_HIDE_PRIORITY
表示默認隱藏優(yōu)先級。
Since:
7
UNSPECIFIED_REFERENCE_SIZE
public static final int UNSPECIFIED_REFERENCE_SIZE
指示換行參考尺寸的默認值,它等于組件的寬度及其邊距。
Since:
5
referenceSize
public int referenceSize
表示換行參考大小。 如果新組件的換行參考尺寸與當前行中現(xiàn)有組件的換行參考尺寸之和超過布局的總寬度,則該組件將被放置到下一行。
Since:
5
構(gòu)造函數(shù)詳細信息
LayoutConfig
public LayoutConfig()
用于創(chuàng)建 LayoutConfig 實例的默認構(gòu)造函數(shù),默認寬度和高度為 ComponentContainer.LayoutConfig#MATCH_CONTENT。
Since:
5
LayoutConfig
public LayoutConfig(Context context, AttrSet attrSet)
用于創(chuàng)建具有指定應用程序上下文和屬性集的 LayoutConfig 實例的構(gòu)造函數(shù)。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| context | 指示應用程序上下文。 |
| attrSet | 指示要使用的屬性集。 |
Since:
5
LayoutConfig
public LayoutConfig(int width, int height)
用于創(chuàng)建具有指定寬度和高度的 LayoutConfig 實例的構(gòu)造函數(shù)。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| width | 表示要設置的寬度。 |
| height | 表示要設置的高度。 |
Since:
5
LayoutConfig
public LayoutConfig(ComponentContainer.LayoutConfig source)
用于創(chuàng)建 LayoutConfig 實例的構(gòu)造函數(shù),使用父布局的參數(shù)。
使用填充、邊距、對齊模式和換行參考大?。ㄓ?referenceSize 表示)的默認值。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| source | 表示父布局的參數(shù)。 |
Since:
5
LayoutConfig
public LayoutConfig(MagicLayout.LayoutConfig source)
用于創(chuàng)建 LayoutConfig 實例的構(gòu)造函數(shù),使用當前 MagicLayout 的參數(shù)(包括寬度、高度、填充、邊距、對齊方式和換行參考大小)。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| source | 表示當前MagicLayout的參數(shù)。 |
Since:
5
方法詳情
getScaleRatioOfParentWidth
public float getScaleRatioOfParentWidth()
獲取縮放組件的寬度與其父 MagicLayout 寬度的比率。
返回:
返回寬度比率。
Since:
7
setScaleRatioOfParentWidth
public void setScaleRatioOfParentWidth(float widthRatio)
設置縮放組件的寬度與其父 MagicLayout 的寬度的比率。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| widthRatio | 表示寬度比例,范圍為[0.0, 1.0]。 |
Since:
7
getScaleRatioOfParentHeight
public float getScaleRatioOfParentHeight()
獲取縮放組件的高度與其父 MagicLayout 高度的比率。
返回:
返回高度比。
Since:
7
setScaleRatioOfParentHeight
public void setScaleRatioOfParentHeight(float heightRatio)
設置縮放組件的高度與其父 MagicLayout 高度的比率。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| heightRatio | 表示高度比,范圍[0.0, 1.0]。 |
Since:
7
getMaxScaleWidth
public int getMaxScaleWidth()
獲取 MagicLayout 中縮放組件的最大寬度。
返回:
返回縮放組件的最大寬度。
Since:
7
setMaxScaleWidth
public void setMaxScaleWidth(int maxScaleWidth)
設置 MagicLayout 中縮放組件的最大寬度。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| maxScaleWidth | 表示縮放組件的最大寬度。 |
Since:
7
getMinScaleWidth
public int getMinScaleWidth()
獲取 MagicLayout 中縮放組件的最小寬度。
返回:
返回縮放組件的最小寬度。
Since:
7
setMinScaleWidth
public void setMinScaleWidth(int minScaleWidth)
設置 MagicLayout 中縮放組件的最小寬度。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| minScaleWidth | 表示縮放組件的最小寬度。 |
Since:
7
getMaxScaleHeight
public int getMaxScaleHeight()
獲取 MagicLayout 中縮放組件的最大高度。
返回:
返回縮放組件的最大高度。
Since:
7
setMaxScaleHeight
public void setMaxScaleHeight(int maxScaleHeight)
設置 MagicLayout 中縮放組件的最大高度。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| maxScaleHeight | 表示縮放組件的最大高度。 |
Since:
7
getMinScaleHeight
public int getMinScaleHeight()
獲取 MagicLayout 中縮放組件的最小高度。
返回:
返回縮放組件的最小高度。
Since:
7
setMinScaleHeight
public void setMinScaleHeight(int minScaleHeight)
設置 MagicLayout 中縮放組件的最小高度。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| minScaleHeight | 指示縮放組件的最小高度。 |
Since:
7
setLayoutWeight
public void setLayoutWeight(float layoutWeight)
設置 MagicLayout 中組件的權(quán)重。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| layoutWeight | 表示組件的重量。 |
Since:
7
getLayoutWeight
public float getLayoutWeight()
獲取 MagicLayout 中組件的權(quán)重。
返回:
組件的重量。
Since:
7
setHidePriority
public void setHidePriority(int hidePriority)
設置 MagicLayout 中組件的隱藏優(yōu)先級。 較小的值表示較高的優(yōu)先級。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| hidePriority | 表示組件的隱藏優(yōu)先級。 |
Since:
7
getHidePriority
public int getHidePriority()
獲取 MagicLayout 中組件的隱藏優(yōu)先級。
返回:
組件的隱藏優(yōu)先級。
Since:
7
applyToComponent
public void applyToComponent(Component component)
文章名稱:創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OSMagicLayout.LayoutConfig
路徑分享:http://www.dlmjj.cn/article/cdghddg.html


咨詢
建站咨詢
