鴻蒙OS LayoutManager

2022-09-23 10:59 更新

LayoutManager

java.lang.Object

|---ohos.agp.components.LayoutManager

public abstract class LayoutManager
extends Object

所有布局管理器的抽象類。

構(gòu)造函數(shù)摘要

構(gòu)造函數(shù) 描述
LayoutManager() 用于創(chuàng)建 LayoutManager 實(shí)例的默認(rèn)構(gòu)造函數(shù)。

方法總結(jié)

修飾符和類型 方法 描述
int getOrientation() 獲取布局方向。
void setOrientation(int orientation) 設(shè)置布局方向。
從類 java.lang.Object 繼承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

構(gòu)造函數(shù)詳細(xì)信息

LayoutManager

public LayoutManager()

用于創(chuàng)建 LayoutManager 實(shí)例的默認(rèn)構(gòu)造函數(shù)。

方法詳情

setOrientation

public void setOrientation(int orientation)

設(shè)置布局方向。

如果不設(shè)置布局方向,則默認(rèn)使用 Component.VERTICAL。

參數(shù):

參數(shù)名稱 參數(shù)描述
orientation 指示要設(shè)置的布局方向。 Component.HORIZONTAL 表示組件水平排列,Component.VERTICAL 表示組件垂直排列。

Throws:

Throw名稱 Throw描述
IllegalArgumentException 如果參數(shù)值與 Component.HORIZONTAL 或 Component.VERTICAL 不對應(yīng),則引發(fā)異常。

getOrientation

public int getOrientation()

獲取布局方向。

返回:

如果組件水平排列,則返回 Component.HORIZONTAL; 如果組件是垂直排列的,則返回 Component.VERTICAL。

以上內(nèi)容是否對您有幫助:
在線筆記
App下載
App下載

掃描二維碼

下載編程獅App

公眾號
微信公眾號

編程獅公眾號