优惠码 第39页

鸿蒙OS ComponentContainer.LayoutConfig

ComponentContainer.LayoutConfig java.lang.Object |—ohos.agp.components.ComponentContainer.LayoutConfig public static class ComponentContainer.LayoutConfig extends Object implements Cloneable 提供布局参数,例如宽度和高度以及边距。 可以提供每个子组件的边距布局信息。 字段摘要 修饰符和类型 字段 描述 int height 组件高度。 static int MATCH_CONTENT MATCH_CONTENT 意味着组件将足够大以包含其内容并使用自己的填充。 static int MATCH_PARENT MATCH_PARENT 表示每个子组件将与其父组件大小相同,但需要扣除父填充大小(如果有)。 int width 组件宽度。 构造函数摘要 构造函数 描述 LayoutConfig() 默认构造函数用于创建 LayoutConfig 实例,其宽度和高度默认设置为 MATCH_CONTENT。 LayoutConfig(int width, int height) 用于通过指定宽度和高度来创建 LayoutConfig 实例的构造函数。 LayoutConfig(ComponentContainer.LayoutConfig config) 用于从现有 LayoutConfig 实例创建 LayoutConfig 实例的构造函数。 LayoutConfig(Context context, AttrSet attrSet) 从 AttrSet 获取属性以实例化 LayoutConfig。 方法总结 修饰符和类型 方法 描述 Object clone() 创建并返回此对象的副本。 int getHorizontalEndMargin() 获取结束边距。 int getHorizontalStartMargin() 获取起始边距。 Component.LayoutDirection getLayoutDirection() 返回布局方向:LayoutDirection#LTR 或 LayoutDirection#RTL int getMarginBottom() 获取下边距。 int getMarginLeft() 获取左边距。 int getMarginRight() 获得右边距。 int[] getMargins() 获取组件的左、上、右、下边距。 int[] getMarginsLeftAndRight() 获取组件的水平(左右)边距。 int[] getMarginsTopAndBottom() 获取组件的垂直(顶部和底部)边距。 int getMarginTop() 获得上边距。 protected boolean isMarginsRelative() 检查当前边距是否是相对的。 void setMarginBottom(int bottom) 设置组件的下边距。 void setMarginLeft(int left) 设置组件的左边距。 void setMarginRight(int right) 设置组件的右边距。 void setMargins(int left, int top, int right, int bottom) 以整数设置边距。 void setMarginsLeftAndRight(int left, int right) 设置组件的水平(左右)边距。 void setMarginsRelative(int start, int top, int end, int bottom) 以整数设置相对边距。 void setMarginsTopAndBottom(int top, int bottom) 设置组件的垂直(顶部和底部)边距。 void setMarginTop(int top) 设置组件的上边距。 从类 java.lang.Object 继承的方法 equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 字段详细信息 MATCH_CONTENT public static final int MATCH_CONTENT MATCH_CONTENT 意味着组件将足够大以包含其内容并使用自己的填充。 MATCH_PARENT public static...

鸿蒙OS ComponentContainer

ComponentContainer java.lang.Object |—ohos.agp.components.Component |—|—ohos.agp.components.ComponentContainer public abstract class ComponentContainer extends Component implements ComponentParent 可以包含其他组件(称为子组件)的特殊组件。 此布局基类继承自 Component。 嵌套类摘要 修饰符和类型 类 描述 static interface ComponentContainer.ArrangeListener 提供自定义组件排列流程的接口。 static class ComponentContainer.LayoutConfig 提供布局参数,例如宽度和高度以及边距。 从类 ohos.agp.components.Component 继承的嵌套类/接口 Component.BindStateChangedListener, Component.CanAcceptScrollListener, Component.ClickedListener, Component.ComponentStateChangedListener, Component.ContourRefreshedListener, Component.DefSpeechEventListener, Component.DoubleClickedListener, Component.DragFeedbackProvider, Component.DraggedListener, Component.DrawTask, Component.EditEventListener, Component.EstimateSizeListener, Component.EstimateSpec, Component.FadeEffectEnum, Component.FocusChangedListener, Component.ForwardHoverListener, Component.ForwardTouchListener, Component.GestureType, Component.HoverEventListener, Component.KeyEventListener, Component.LayoutDirection, Component.LayoutRefreshedListener, Component.LongClickedListener, Component.MeasureSpec, Component.MouseEventListener, Component.MousePointerStyleListener, Component.OnDragListener, Component.RotationEventListener, Component.ScaledListener, Component.ScrolledListener, Component.ShadowDevice, Component.ShadowMode, Component.ShadowSize, Component.SpeechEventListener, Component.TouchEventListener, Component.UnconsumedKeyEventListener, Component.VoiceEvent 字段摘要 修饰符和类型 字段 描述 static int FOCUS_CHILDREN_FIRST 指示此组件在其任何子项之前获得焦点。 static int FOCUS_CHILDREN_HIDE 指示此组件阻止其子级获得焦点,即使它们是可聚焦的。 static int FOCUS_PARENT_FIRST 指示仅当其子组件均未请求焦点时,此组件才获得焦点。 protected ComponentContainer.ArrangeListener mArrangeListener 在排列过程中自定义子组件的排列 从类 ohos.agp.components.Component 继承的字段 ACCESSIBILITY_ADAPTABLE, ACCESSIBILITY_DISABLE, ACCESSIBILITY_ENABLE, AXIS_X, AXIS_Y, CONTOUR_BACKGROUND, CONTOUR_BORDER, CONTOUR_PADDING_BORDER, DEFAULT_SCALE, DRAG_DOWN, DRAG_HORIZONTAL, DRAG_HORIZONTAL_VERTICAL, DRAG_LEFT, DRAG_RIGHT, DRAG_UP, DRAG_VERTICAL, EVENT_TYPE_COMPONENT_ACCESSIBILITY_FOCUSED, EVENT_TYPE_COMPONENT_ACCESSIBILITY_FOCUSED_CLEAR, EVENT_TYPE_COMPONENT_CLICKED, EVENT_TYPE_COMPONENT_FOCUSED, EVENT_TYPE_COMPONENT_LONG_CLICKED, EVENT_TYPE_COMPONENT_SCROLLED, EVENT_TYPE_COMPONENT_SELECTED, EVENT_TYPE_COMPONENT_TEXT_UPDATE, EVENT_TYPE_NOTICE, EVENT_TYPE_NOTIFICATION_STATE_UPDATE, EVENT_TYPE_TOAST_SHOW, EVENT_TYPE_WINDOW_STATE_UPDATE, FOCUS_ADAPTABLE, FOCUS_DISABLE, FOCUS_ENABLE, FOCUS_NEXT, FOCUS_PREVIOUS, FOCUS_SIDE_BOTTOM, FOCUS_SIDE_LEFT, FOCUS_SIDE_RIGHT, FOCUS_SIDE_TOP, HIDE, HORIZONTAL, ID_DEFAULT, INHERITED_MODE, INVISIBLE, mBackgroundElement, mCanvasForTaskOverContent, mCanvasForTaskUnderContent, mComponentParent, mContext, mDrawTaskOverContent, mDrawTaskUnderContent, mEstimateSizeListener, mForegroundElement, mForwardHoverListener, mHoverEventListener, mKeyEventListener, mMouseEventListener, mPosition, mRotationEventListener, mShadowElement, mUnconsumedKeyEventListener, OVAL_MODE, OVAL_SCROLL_BAR_MODE, POSITION_X_INDEX, POSITION_Y_INDEX, RECT_MODE, RECT_SCROLL_BAR_MODE, SCROLL_AUTO_STAGE, SCROLL_IDLE_STAGE, SCROLL_NORMAL_STAGE, UNSPECIFIED_SCROLL_BAR_MODE, VERTICAL, VISIBLE 构造函数摘要 构造函数 描述 ComponentContainer(Context context) 默认构造函数用于使用默认属性集和样式创建 ComponentContainer 实例。 ComponentContainer(Context context, AttrSet attrSet) 用于在 XML 文件解析后使用指定的属性集和默认样式创建 ComponentContainer 实例的构造函数。 ComponentContainer(Context context, AttrSet attrSet, String styleName) 一个构造函数,用于在解析 XML 文件后使用指定的属性集和指定的样式创建一个 ComponentContainer 实例。 方法总结 修饰符和类型 方法 描述 void addComponent(Component childComponent) 通过在内部调用 addComponent(ohos.agp.components.Component,int index) 将组件添加到队列的末尾。 void addComponent(Component childComponent, int index) 将组件添加到指定位置。 void addComponent(Component childComponent, int width, int height) 添加一个组件并设置其宽度和高度。 void addComponent(Component childComponent, int index, ComponentContainer.LayoutConfig layoutConfig) 添加组件并设置其布局参数和位置。 void addComponent(Component childComponent, ComponentContainer.LayoutConfig layoutConfig) 添加一个组件并设置其布局参数。 ComponentContainer.LayoutConfig createLayoutConfig(Context context, AttrSet attrSet) 使用子组件的属性集创建布局参数。 protected void dispatchRestoreState(PlainArraySequenceable stateContainer) 分发状态恢复过程来恢复该组件及其子组件的状态。 protected void dispatchSaveState(PlainArraySequenceable stateContainer) 分发状态保存过程,保存该组件及其子组件的状态。 <T extends Component>T findComponentById(int id) 查找具有给定 ID 的组件。 ComponentHolder findComponentHolderById(int resId) 使用资源 id 获取 componentHolder 的实例。 boolean getAutoLayout() 获取是否启用自动布局。 int getChildCount() 获取子组件的数量。 int getChildIndex(Component component) 查询子组件的位置。 Component getComponentAt(int index) 使用索引获取子组件。 ComponentTransition getComponentTransition() 获取组件的 ComponentTransition 对象。 int getFocusOrder() 获取此组件相对于其后代的可聚焦性。 LayoutManager getLayoutManager() 获取一个LayoutManager对象,用于对相关子组件进行布局。 void informConfigurationChanged(Configuration config) 调度配置更改事件。 boolean isClipToChildBoundsEnabled() 获取子组件的绘制范围是否可以超出子组件的边界。 boolean...

鸿蒙OS Component.VoiceEvent

Component.VoiceEvent java.lang.Object |—ohos.agp.components.Component.VoiceEvent public static class Component.VoiceEvent extends Object 为组件提供语音事件。 构造函数摘要 构造函数 描述 VoiceEvent(String speech) 用于根据热门词创建 VoiceEvent 实例的构造函数。 VoiceEvent(String speech, int scene, boolean isUseBadge) 用于根据热词、事件场景以及是否使用事件徽章创建 VoiceEvent 实例的构造函数。 方法总结 修饰符和类型 方法 描述 void addBadges(String from, String to) 设置场景的开始和结束事件徽章。 void addSynonyms(String synonyms) 向语音事件添加同义词。 ListString[] getBadge() 获取事件徽章。 int getScene() 获取事件场景。 String getSpeech() 获取事件语音。 ListString getSynonyms() 获取事件同义词。 void sendDataToComponent(Component component) 将此对象绑定到组件。 void setBadge(boolean enable) 设置事件徽章。 void setScene(int scene) 设置事件场景。 从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 构造函数详细信息 VoiceEvent public VoiceEvent(String speech, int scene, boolean isUseBadge) 用于根据热词、事件场景以及是否使用事件徽章创建 VoiceEvent 实例的构造函数。 参数: 参数名称 参数描述 speech 表示热词。 scene 指示使用此事件的场景。 isUseBadge 指定是否使用事件徽章。 值 true 表示使用徽章,false 表示相反。 VoiceEvent public VoiceEvent(String speech) 用于根据热门词创建 VoiceEvent 实例的构造函数。 参数: 参数名称 参数描述 speech 表示热词。 方法详情 addSynonyms public void addSynonyms(String synonyms) 向语音事件添加同义词。 参数: 参数名称 参数描述 synonyms 表示要添加的同义词。 setScene public void setScene(int scene) 设置事件场景。 参数: 参数名称 参数描述 scene 指示将使用事件的场景。 setBadge public void setBadge(boolean enable) 设置事件徽章。 参数: 参数名称 参数描述 enable 指定是否启用事件标记。 值 true 表示启用标记,false 表示禁用标记。 addBadges...

鸿蒙OS Component.MeasureSpec

Component.MeasureSpec java.lang.Object |—ohos.agp.components.Component.MeasureSpec @Deprecated public static class Component.MeasureSpec extends Object 已弃用。 此更改自 API 版本 6 起生效。已替换为 EstimateSpec 字段摘要 修饰符和类型 字段 描述 static int ESTIMATED_STATE_BIT_MASK 已弃用。 static int NOT_EXCEED 已弃用。 static int PRECISE 已弃用。 static int UNCONSTRAINT 已弃用。 构造函数摘要 构造函数 描述 MeasureSpec() 已弃用。 方法总结 修饰符和类型 方法 描述 static int getMeasureSpec(int size, int mode) 已弃用。 static int getMode(int measureSpec) 已弃用。 static int getSize(int measureSpec) 已弃用。 static int getSizeAndConfig(int size, int estimatedConfig, int childEstimatedConfig) 已弃用。 从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 字段详细信息 ESTIMATED_STATE_BIT_MASK @Deprecated public static final int ESTIMATED_STATE_BIT_MASK 已弃用。 估计大小的状态位 NOT_EXCEED @Deprecated public static final int NOT_EXCEED 已弃用。 在此模式下,已为子组件指定了最大尺寸。 子组件不能超过指定的大小。 PRECISE @Deprecated public static final int PRECISE 已弃用。 在这种模式下,父组件已经确定了子组件的确切大小。 UNCONSTRAINT @Deprecated public static final int UNCONSTRAINT 已弃用。 在这种模式下,父组件对子组件没有限制,这意味着子组件可以是任何它想要的大小。 构造函数详细信息 MeasureSpec @Deprecated public MeasureSpec() 已弃用。 方法详情 getMeasureSpec @Deprecated public static int getMeasureSpec(int size, int mode) 已弃用。 根据指定的大小和模式创建度量规范。 参数: 参数名称 参数描述 size 指示度量规范中包含的大小。 取值范围为 0 到(1 左移 MeasureSpec.MODE_SHIFT 位),包括 1。 mode...

鸿蒙OS Component.EstimateSpec

Component.EstimateSpec java.lang.Object |—ohos.agp.components.Component.EstimateSpec public static class Component.EstimateSpec extends Object 定义组件的度量规范。 EstimateSpec 封装了子组件从父组件继承的排列要求。 每个 EstimateSpec 指示对宽度或高度以及模式的要求。 EstimateSpec 有三种可能的模式:UNCONSTRAINT、PRECISE 和 NOT_EXCEED。 字段摘要 修饰符和类型 字段 描述 static int ESTIMATED_STATE_BIT_MASK 估计大小的状态位 static int NOT_EXCEED 在此模式下,已为子组件指定了最大尺寸。 static int PRECISE 在这种模式下,父组件已经确定了子组件的确切大小。 static int UNCONSTRAINT 在这种模式下,父组件对子组件没有限制,这意味着子组件可以是任何它想要的大小。 构造函数摘要 构造函数 描述 EstimateSpec() 方法总结 修饰符和类型 方法 描述 static int getChildSizeWithMode(int size, int estimatedConfig, int childEstimatedConfig) 根据指定的大小和模式为子组件创建度量规范。 static int getMode(int estimateSpec) 获取该组件的显示方式。 static int getSize(int estimateSpec) 从提供的估计规范中提取大小。 static int getSizeWithMode(int size, int mode) 根据指定的大小和模式创建度量规范。 从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 字段详细信息 ESTIMATED_STATE_BIT_MASK public static final int ESTIMATED_STATE_BIT_MASK 估计大小的状态位 NOT_EXCEED public static final int NOT_EXCEED 在此模式下,已为子组件指定了最大尺寸。 子组件不能超过指定的大小。 PRECISE public static final int PRECISE 在这种模式下,父组件已经确定了子组件的确切大小。 UNCONSTRAINT public static final int UNCONSTRAINT 在这种模式下,父组件对子组件没有限制,这意味着子组件可以是任何它想要的大小。 构造函数详细信息 EstimateSpec public EstimateSpec() 方法详情 getSizeWithMode public static int getSizeWithMode(int size, int mode) 根据指定的大小和模式创建度量规范。 参数: 参数名称 参数描述 size 指示度量规范中包含的宽度或高度。 mode 指示度量规范中包含的模式。 该值必须是 UNCONSTRAINT、PRECISE 或 NOT_EXCEED。 返回: 以模式返回大小。 getMode public static int getMode(int estimateSpec) 获取该组件的显示方式。 参数:...

鸿蒙OS Component.DragFeedbackProvider

Component.DragFeedbackProvider java.lang.Object |—ohos.agp.components.Component.DragFeedbackProvider public static class Component.DragFeedbackProvider extends Object 提供系统在拖放操作期间显示的图像(称为“拖动阴影”)。 开始拖动时传递一个 DragFeedbackProvider 对象对应的组件。 构造函数摘要 构造函数 描述 DragFeedbackProvider(Component component) 创建系统在拖放操作期间显示的图像(称为“拖动阴影”)。 方法总结 修饰符和类型 方法 描述 Component getComponent() 返回 DragFeedbackProvider 的组件。 从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 构造函数详细信息 DragFeedbackProvider public DragFeedbackProvider(Component component) 创建系统在拖放操作期间显示的图像(称为“拖动阴影”)。 参数: 参数名称 参数描述 component 阴影 方法详情 getComponent public final Component getComponent() 返回 DragFeedbackProvider 的组件。 返回: Component

鸿蒙OS Component.DefSpeechEventListener

Component.DefSpeechEventListener java.lang.Object |—ohos.agp.components.Component.DefSpeechEventListener public static class Component.DefSpeechEventListener extends Object implements Component.SpeechEventListener 提供在语音事件绑定到组件时调用的默认回调。 构造函数摘要 构造函数 描述 DefSpeechEventListener() 方法总结 修饰符和类型 方法 描述 boolean onSpeechEvent(Component component, SpeechEvent event) 当语音事件绑定到组件时调用。 从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 构造函数详细信息 DefSpeechEventListener public DefSpeechEventListener() 方法详情 onSpeechEvent public boolean onSpeechEvent(Component component, SpeechEvent event) 当语音事件绑定到组件时调用。 您需要实现此回调来处理语音事件。 指定者: 接口 Component.SpeechEventListener 中的 onSpeechEvent 参数: 参数名称 参数描述 component 表示绑定到语音事件的组件。 event 表示语音事件。 返回: 如果侦听器已经处理了语音事件,则返回 true; 否则返回 false。

鸿蒙OS AttrHelper

AttrHelper java.lang.Object |—ohos.agp.components.AttrHelper public class AttrHelper extends Object 将属性值的类型从字符串转换为整数或布尔值。 构造函数摘要 构造函数 描述 AttrHelper() 用于创建 AttrHelper 实例的默认构造函数。 方法总结 修饰符和类型 方法 描述 static int convertDimensionToPix(String value, float density, int defaultValue) 将尺寸值转换为像素数。 static int convertDimensionToPix(Context context, String value, int defaultValue) 将维度值转换为像素值。 static BlendMode convertValueToBlendMode(String value, BlendMode defaultValue) 将值从字符串转换为整数。 static boolean convertValueToBoolean(String value, boolean defaultValue) 将值从字符串转换为布尔值。 static Color convertValueToColor(String value) 将字符串转换为 Color 对象。 static ColorMatrix convertValueToColorMatrix(int value) 将值从 int 转换为 ColorMatrix 对象。 static Element convertValueToElement(String value) 将字符串转换为 Element 对象。 static float convertValueToFloat(String value, float defaultValue) 将字符串转换为浮点值。 static int convertValueToInt(String value, int defaultValue) 将值从字符串转换为整数。 static long convertValueToLong(String value, long defaultValue) 将字符串转换为长值。 static int fp2px(float value, float density) 根据屏幕密度将字体大小像素 (fp) 转换为像素值。 static int fp2px(float value, float density, float fontRatio) 根据屏幕密度和字体比率将字体大小像素 (fp) 值转换为像素值。 static int fp2px(float value, Context context) 根据屏幕上下文将字体大小像素 (fp) 转换为像素值。 static float getDensity(Context context) 获取显示密度。 static float getFontRatio(Context context) 获取字体比例。 static float px2fp(int value, Context context) 根据屏幕上下文将像素转换为字体大小的像素。 static float px2vp(int value, Context context) 根据屏幕上下文将像素转换为虚拟像素。 static int vp2px(float value, float density) 根据屏幕密度将虚拟像素 (vp) 转换为像素值。 static int vp2px(float value, Context context) 根据屏幕上下文将虚拟像素 (vp) 转换为像素值。 从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 构造函数详细信息 AttrHelper public AttrHelper() 用于创建 AttrHelper 实例的默认构造函数。 方法详情 getDensity public static float getDensity(Context context) 获取显示密度。 参数: 参数名称 参数描述 context 指示应用程序上下文。 返回: 返回显示密度。 getFontRatio public static float getFontRatio(Context context) 获取字体比例。 参数: 参数名称 参数描述 context 指示应用程序上下文。 返回: 返回字体比例。 convertValueToInt public static int convertValueToInt(String...

鸿蒙OS AdaptiveBoxLayout.LayoutConfig

AdaptiveBoxLayout.LayoutConfig java.lang.Object |—ohos.agp.components.ComponentContainer.LayoutConfig |—|—ohos.agp.components.AdaptiveBoxLayout.LayoutConfig public static class AdaptiveBoxLayout.LayoutConfig extends ComponentContainer.LayoutConfig 为 AdaptiveBoxLayout 实例中的子组件定义布局参数,包括它们的宽度、高度、边距和重力。 字段摘要 修饰符和类型 字段 描述 int alignment 表示组件的对齐值。 从类 ohos.agp.components.ComponentContainer.LayoutConfig 继承的字段 height, MATCH_CONTENT, MATCH_PARENT, width 构造函数摘要 构造函数 描述 LayoutConfig() 默认构造函数用于通过将宽度和高度设置为默认值 MATCH_CONTENT 来创建 AdaptiveBoxLayout.LayoutConfig 实例。 LayoutConfig(int width, int height) 用于通过指定宽度和高度来创建 AdaptiveBoxLayout.LayoutConfig 实例的构造函数。 LayoutConfig(int width, int height, int alignment) 用于通过指定宽度、高度和重力来创建 AdaptiveBoxLayout.LayoutConfig 实例的构造函数。 LayoutConfig(AdaptiveBoxLayout.LayoutConfig source) 一个构造函数,用于通过从现有实例中提取宽度、高度、边距和重力设置来创建 AdaptiveBoxLayout.LayoutConfig 实例。 LayoutConfig(ComponentContainer.LayoutConfig source) 用于通过从现有实例中提取宽度、高度和边距设置来创建 AdaptiveBoxLayout.LayoutConfig 实例的构造函数。 LayoutConfig(Context context, AttrSet attrSet) 用于根据上下文和属性集创建 AdaptiveBoxLayout.LayoutConfig 实例的构造函数。 方法总结 从类 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 字段详细信息 alignment public int alignment 表示组件的对齐值。 仅支持水平方向。 构造函数详细信息 LayoutConfig public LayoutConfig() 默认构造函数用于通过将宽度和高度设置为默认值 MATCH_CONTENT 来创建 AdaptiveBoxLayout.LayoutConfig 实例。 LayoutConfig public LayoutConfig(int width, int height) 用于通过指定宽度和高度来创建 AdaptiveBoxLayout.LayoutConfig 实例的构造函数。 参数: 参数名称 参数描述 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) 用于通过指定宽度、高度和重力来创建 AdaptiveBoxLayout.LayoutConfig 实例的构造函数。 参数: 参数名称 参数描述 width 表示宽度,可以是具体的值,ComponentContainer.LayoutConfig.MATCH_PARENT,或者ComponentContainer.LayoutConfig.MATCH_CONTENT。 height 表示高度,可以是特定值,ComponentContainer.LayoutConfig.MATCH_PARENT,或ComponentContainer.LayoutConfig.MATCH_CONTENT。 alignment 表示对齐值。 LayoutConfig public LayoutConfig(Context context, AttrSet attrSet) 用于根据上下文和属性集创建 AdaptiveBoxLayout.LayoutConfig 实例的构造函数。 参数: 参数名称 参数描述 context 指示应用程序上下文。 attrSet 指示要使用的属性集。 LayoutConfig public LayoutConfig(ComponentContainer.LayoutConfig source)...

鸿蒙OS AdaptiveBoxLayout

AdaptiveBoxLayout java.lang.Object |—ohos.agp.components.Component |—|—ohos.agp.components.ComponentContainer |—|—|—ohos.agp.components.AdaptiveBoxLayout public class AdaptiveBoxLayout extends ComponentContainer 提供用于创建自适应框布局的方法。 自适应框布局会自动划分为具有相同宽度和可能不同高度的框的行和列。 框的宽度取决于布局宽度和每行中的框数,由布局策略指定。 只有在前一行被填满后才会开始新行。 每个盒子都包含一个子组件。 每个盒子的高度由它所包含的子组件的高度决定。 每行的高度由该行中最高的框确定。 布局的宽度只能设置为 MATCH_PARENT 或固定值。 可以为布局中的组件设置长度、宽度和对齐方式。 嵌套类摘要 修饰符和类型 类 描述 static class AdaptiveBoxLayout.LayoutConfig 为 AdaptiveBoxLayout 实例中的子组件定义布局参数,包括它们的宽度、高度、边距和重力。 从类 ohos.agp.components.Component 继承的嵌套类/接口 Component.BindStateChangedListener, Component.CanAcceptScrollListener, Component.ClickedListener, Component.ComponentStateChangedListener, Component.ContourRefreshedListener, Component.DefSpeechEventListener, Component.DoubleClickedListener, Component.DragFeedbackProvider, Component.DraggedListener, Component.DrawTask, Component.EditEventListener, Component.EstimateSizeListener, Component.EstimateSpec, Component.FadeEffectEnum, Component.FocusChangedListener, Component.ForwardHoverListener, Component.ForwardTouchListener, Component.GestureType, Component.HoverEventListener, Component.KeyEventListener, Component.LayoutDirection, Component.LayoutRefreshedListener, Component.LongClickedListener, Component.MeasureSpec, Component.MouseEventListener, Component.MousePointerStyleListener, Component.OnDragListener, Component.RotationEventListener, Component.ScaledListener, Component.ScrolledListener, Component.ShadowDevice, Component.ShadowMode, Component.ShadowSize, Component.SpeechEventListener, Component.TouchEventListener, Component.UnconsumedKeyEventListener, Component.VoiceEvent 从类 ohos.agp.components.ComponentContainer 继承的嵌套类/接口 ComponentContainer.ArrangeListener 字段摘要 从类 ohos.agp.components.Component 继承的字段 ACCESSIBILITY_ADAPTABLE, ACCESSIBILITY_DISABLE, ACCESSIBILITY_ENABLE, AXIS_X, AXIS_Y, CONTOUR_BACKGROUND, CONTOUR_BORDER, CONTOUR_PADDING_BORDER, DEFAULT_SCALE, DRAG_DOWN, DRAG_HORIZONTAL, DRAG_HORIZONTAL_VERTICAL, DRAG_LEFT, DRAG_RIGHT, DRAG_UP, DRAG_VERTICAL, EVENT_TYPE_COMPONENT_ACCESSIBILITY_FOCUSED, EVENT_TYPE_COMPONENT_ACCESSIBILITY_FOCUSED_CLEAR, EVENT_TYPE_COMPONENT_CLICKED, EVENT_TYPE_COMPONENT_FOCUSED, EVENT_TYPE_COMPONENT_LONG_CLICKED, EVENT_TYPE_COMPONENT_SCROLLED, EVENT_TYPE_COMPONENT_SELECTED, EVENT_TYPE_COMPONENT_TEXT_UPDATE, EVENT_TYPE_NOTICE, EVENT_TYPE_NOTIFICATION_STATE_UPDATE, EVENT_TYPE_TOAST_SHOW, EVENT_TYPE_WINDOW_STATE_UPDATE, FOCUS_ADAPTABLE, FOCUS_DISABLE, FOCUS_ENABLE, FOCUS_NEXT, FOCUS_PREVIOUS, FOCUS_SIDE_BOTTOM, FOCUS_SIDE_LEFT, FOCUS_SIDE_RIGHT, FOCUS_SIDE_TOP, HIDE, HORIZONTAL, ID_DEFAULT, INHERITED_MODE, INVISIBLE, mBackgroundElement, mCanvasForTaskOverContent, mCanvasForTaskUnderContent, mComponentParent, mContext, mDrawTaskOverContent, mDrawTaskUnderContent, mEstimateSizeListener, mForegroundElement, mForwardHoverListener, mHoverEventListener, mKeyEventListener, mMouseEventListener, mPosition, mRotationEventListener, mShadowElement, mUnconsumedKeyEventListener, OVAL_MODE, OVAL_SCROLL_BAR_MODE, POSITION_X_INDEX, POSITION_Y_INDEX, RECT_MODE, RECT_SCROLL_BAR_MODE, SCROLL_AUTO_STAGE, SCROLL_IDLE_STAGE, SCROLL_NORMAL_STAGE, UNSPECIFIED_SCROLL_BAR_MODE, VERTICAL, VISIBLE 从类 ohos.agp.components.ComponentContainer 继承的字段 FOCUS_CHILDREN_FIRST, FOCUS_CHILDREN_HIDE, FOCUS_PARENT_FIRST, mArrangeListener 构造函数摘要 构造函数 描述 AdaptiveBoxLayout(Context context) 用于使用默认属性集和样式创建 AdaptiveBoxLayout 实例的默认构造函数。 AdaptiveBoxLayout(Context context, AttrSet attrSet) 用于在解析 XML 文件后使用指定的属性集和默认样式创建 AdaptiveBoxLayout 实例的构造函数。 AdaptiveBoxLayout(Context context, AttrSet attrSet, String styleName) 用于在 XML 文件解析后使用指定的属性集和指定的样式创建 AdaptiveBoxLayout 实例的构造函数。 方法总结 修饰符和类型 方法 描述 void addAdaptiveRule(int minWidth, int maxWidth, int columns) 添加一个自适应规则,指定宽度在指定范围内的布局中每行允许的框数。 void clearAdaptiveRules() 清除所有自适应规则。 ComponentContainer.LayoutConfig createLayoutConfig(Context context, AttrSet attrSet) 使用子组件的属性集创建布局参数。 void removeAdaptiveRule(int minWidth, int maxWidth, int columns) 删除指定的规则。 ComponentContainer.LayoutConfig verifyLayoutConfig(ComponentContainer.LayoutConfig config) 根据当前布局类型验证布局参数。 从类 ohos.agp.components.Component 继承的方法 addDrawTask, addDrawTask, addScrolledListener, announceAccessibility, arrange, bindCornerMark, callOnClick, canScroll, clearFocus, createAnimatorProperty, disableFadeEffect, draw, enableCornerMark, enableFadeEffect, enableSaveState, enableScrollBar, estimateSize, executeDoubleClick, executeLongClick, findFocus, findNextFocusableComponent, findRequestNextFocus, getAccessibility, getAccessibilityDescription, getAlpha, getAltitude, getBackgroundElement, getBaseLine, getBottom, getBoundaryFadeEffectBottomRate, getBoundaryFadeEffectLeftRate, getBoundaryFadeEffectRightRate, getBoundaryFadeEffectTopRate, getCenterZoomFactor, getCentralScrollMode, getClickedListener, getClipEnabled, getComponentDescription, getComponentMinSize, getComponentParent, getComponentPosition, getComponentSize, getComponentStateChangedListener, getComponentTreeObserver, getContentEnable, getContentPosition, getContentPositionX, getContentPositionY, getContext, getContour, getContourRefreshedListener, getCornerMark, getDragAcceptAngle, getDraggedListener, getEditEventListener, getEstimatedHeight, getEstimatedWidth, getFadeEffectBoundaryWidth, getFadeEffectColor, getFocusable, getFocusBorderEnable, getFocusBorderPadding, getFocusBorderRadius, getFocusBorderWidth, getForegroundElement, getForegroundGravity, getForwardHoverListener, getForwardTouchListener, getGesturePriority, getHeight, getHorizontalPadding, getHorizontalPosition, getHoverEventListener, getId, getKeyEventListener, getLayoutConfig, getLayoutDirection, getLayoutDirectionResolved, getLayoutRefreshedListener, getLeft, getLocationOnScreen, getMarginBottom, getMarginLeft, getMarginRight, getMargins, getMarginsLeftAndRight, getMarginsTopAndBottom, getMarginTop, getMatrix, getMinHeight, getMinWidth, getMode, getModeResolved, getMouseEventListener, getMousePointerStyleListener, getName, getPadding, getPaddingBottom, getPaddingEnd, getPaddingLeft, getPaddingRight, getPaddingStart, getPaddingTop, getPivot, getPivotX, getPivotY, getResourceManager, getRight, getRotation, getRotationEventListener, getRotationSensitivity, getScale, getScaledListener, getScaleX, getScaleY, getScrollbarBackgroundColor, getScrollbarColor, getScrollbarFadingDelay, getScrollbarFadingDuration, getScrollBarMode, getScrollbarRadius, getScrollbarRoundRect, getScrollbarStartAngle, getScrollbarSweepAngle, getScrollbarThickness, getScrollState, getScrollValue, getSelfVisibleRect, getShadowColor, getSpeechEventListener, getTag, getTop, getTouchEventListener, getTransitionSymbol, getTranslation, getTranslationX, getTranslationY, getTranslationZ, getUserNextFocus, getVerticalPadding, getVerticalPosition, getVisibility, getVisibleRectOnScreen, getWidth, getWindowVisibleRect, hasFocus, hasFocusedEffect, hasOverlaps, hideFocusBorder, invalidate, isBoundaryFadeEffectEnable, isBoundToWindow, isClickable, isClipToContourEnabled, isComponentDisplayed, isEnabled, isFadeEffected, isFocusable, isFocused, isIdentityMatrix, isLongClickOn, isPressed, isRtl, isSaveStateEnabled, isScrollbarFadingOn, isScrollBarOn, isScrollbarOverlapEnabled, isSelected, isSoundEnable, isTouchFocusable, isVibrationEffectEnabled, notifyAccessibility, onAttributeConfigChanged, onRestoreState, onRtlChanged, onSaveState, performScale, playSound, postLayout, refreshContour, release, removeBindStateChangedListener, removeScrolledListener, requestFocus, requestForceForwardTouchEvent, restoreComponentTreeState, saveComponentTreeState, scrollBy, scrollTo, setAccessibility, setAccessibilityDescription, setAlpha, setAltitude, setBackground, setBindStateChangedListener, setBottom, setBoundaryFadeEffectEnable, setCanAcceptScrollListener, setCenterZoomFactor, setCentralScrollMode, setClickable, setClickedListener, setClipEnabled, setClipToContourEnabled, setComponentDescription, setComponentMinSize, setComponentPosition, setComponentPosition, setComponentSize, setComponentStateChangedListener, setContentEnable, setContentPosition, setContentPositionX, setContentPositionY, setContour, setContourRefreshedListener, setDoubleClickedListener, setDragAcceptAngle, setDraggedListener, setEditEventListener, setEnabled, setEstimatedSize, setEstimateSizeListener, setFadeEffectBoundaryWidth, setFadeEffectColor, setFocusable, setFocusBorderEnable, setFocusBorderPadding, setFocusBorderRadius, setFocusBorderRadius, setFocusBorderWidth, setFocusChangedListener, setFocusedEffect, setForeground, setForegroundGravity, setForwardHoverListener, setForwardTouchListener, setGesturePriority, setHeight, setHorizontalPadding, setHorizontalPosition, setHoverEventListener, setId, setKeyEventListener, setLayoutConfig, setLayoutDirection, setLayoutRefreshedListener, setLeft, setLongClickable, setLongClickedListener, setMarginBottom, setMarginLeft, setMarginRight, setMarginsLeftAndRight, setMarginsTopAndBottom, setMarginTop, setMinHeight, setMinWidth, setMode, setMouseEventListener, setMousePointerStyleListener, setName, setOnDragListener, setPadding, setPaddingBottom, setPaddingLeft, setPaddingRelative, setPaddingRight, setPaddingTop, setPivot, setPivot, setPivotX, setPivotY, setPosition, setPositionX, setPositionY, setPressState, setRight, setRotation, setRotationEventListener, setRotationSensitivity, setScale, setScaledListener, setScaleX, setScaleY, setScrollbarBackgroundColor, setScrollbarColor, setScrollbarFadingDelay, setScrollbarFadingDuration, setScrollbarFadingEnabled, setScrollBarMode, setScrollbarOverlapEnabled, setScrollbarRadius, setScrollbarRoundRect, setScrollbarStartAngle, setScrollbarSweepAngle, setScrollbarThickness, setScrolledListener, setSelected, setShadowColor, setShadowStyle, setSoundEnable, setSpeechEventListener, setTag, setTop, setTouchEventListener, setTouchFocusable, setTransitionSymbol, setTranslation, setTranslationX, setTranslationY, setTranslationZ, setUnconsumedKeyEventListener, setUserNextFocus, setVerticalPadding, setVerticalPosition, setVibrationEffectEnabled, setVisibility, setWidth, showFocusBorder, simulateClick, simulateDrag, startDragAndDrop, subscribeVoiceEvents, unsubscribeVoiceEvents 从类 ohos.agp.components.ComponentContainer 继承的方法 addComponent, addComponent, addComponent, addComponent, addComponent, dispatchRestoreState, dispatchSaveState, findComponentById, findComponentHolderById, getAutoLayout, getChildCount, getChildIndex, getComponentAt, getComponentTransition, getFocusOrder, getLayoutManager, informConfigurationChanged, isClipToChildBoundsEnabled, isClipToPaddingBoundsEnabled, isTouchEventSplitable, moveChildToFront, onDrag, removeAllComponents, removeComponent, removeComponentAt, removeComponentById, removeComponents, setArrangeListener, setAutoLayout, setAutoLayout, setClipToChildBoundsEnabled, setClipToPaddingBoundsEnabled, setComponentTransition, setFocusOrder, setLayoutManager, setTouchEventSplitable 从接口 ohos.agp.components.ComponentParent 继承的方法 getComponentParent, postLayout 从类 java.lang.Object 继承的方法 clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait 构造函数详细信息 AdaptiveBoxLayout public AdaptiveBoxLayout(Context context) 用于使用默认属性集和样式创建 AdaptiveBoxLayout 实例的默认构造函数。 参数: 参数名称 参数描述 context 指示应用程序上下文。 AdaptiveBoxLayout public AdaptiveBoxLayout(Context context, AttrSet attrSet) 用于在解析 XML 文件后使用指定的属性集和默认样式创建 AdaptiveBoxLayout 实例的构造函数。 参数: 参数名称 参数描述 context 指示应用程序上下文。 attrSet 指示要使用的属性集。...