新聞中心
Image

創(chuàng)新互聯(lián)建站主要從事網(wǎng)站制作、成都網(wǎng)站建設(shè)、網(wǎng)頁(yè)設(shè)計(jì)、企業(yè)做網(wǎng)站、公司建網(wǎng)站等業(yè)務(wù)。立足成都服務(wù)鶴崗,10年網(wǎng)站建設(shè)經(jīng)驗(yàn),價(jià)格優(yōu)惠、服務(wù)專業(yè),歡迎來(lái)電咨詢建站服務(wù):18982081108
java.lang.Object
|---ohos.agp.components.Component
|---|---ohos.agp.components.Image
public class Image
extends Component表示顯示圖像的組件。
Image繼承自Component,用于展示圖片資源。
嵌套類摘要
| 修飾符和類型 | 類 | 描述 |
|---|---|---|
| static class | Image.ScaleMode | 表示圖像的縮放模式。 |
| 從類 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 | CLIP_DIRECTION_NOT_SET | 表示未設(shè)置的圖像剪切方向。 |
| static int | CLIP_GRAVITY_NOT_SET | 表示未設(shè)置的裁剪對(duì)齊模式。 |
| static int | CLIP_HORIZONTAL | 表示水平剪裁模式。 |
| static int | CLIP_VERTICAL | 表示垂直剪裁模式。 |
| static int | GRAVITY_BOTTOM | 表示裁剪圖像的底部對(duì)齊方式。 |
| static int | GRAVITY_CENTER | 表示裁剪圖像的居中對(duì)齊方式。 |
| static int | GRAVITY_LEFT | 表示裁剪圖像的左對(duì)齊方式。 |
| static int | GRAVITY_RIGHT | 表示裁剪圖像的右對(duì)齊方式。 |
| static int | GRAVITY_TOP | 表示裁剪圖像的頂部對(duì)齊方式。 |
| 從類 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 |
構(gòu)造函數(shù)摘要
| 構(gòu)造函數(shù) | 描述 |
|---|---|
| Image(Context context) | 默認(rèn)構(gòu)造函數(shù)用于使用默認(rèn)屬性集和樣式創(chuàng)建 Image 實(shí)例。 |
| Image(Context context, AttrSet attrSet) | 用于在 XML 文件解析后使用指定的屬性集和默認(rèn)樣式創(chuàng)建 Image 實(shí)例的構(gòu)造函數(shù)。 |
| Image(Context context, AttrSet attrSet, String styleName) | 用于在 XML 文件解析后使用指定的屬性集和指定的樣式創(chuàng)建 Image 實(shí)例的構(gòu)造函數(shù)。 |
方法總結(jié)
| 修飾符和類型 | 方法 | 描述 |
|---|---|---|
| int | getClipAlignment() | 獲取圖片裁剪對(duì)齊方式。 |
| int | getClipDirection() | 獲取圖像裁剪方向。 |
| int | getClipGravity() | 已棄用。 此更改從 API 版本 5 開始生效。由 getClipAlignment() 替換 |
| float[] | getCornerRadii() | 獲得四個(gè)角的半徑。 |
| float | getCornerRadius() | 獲取圓角半徑。 |
| Element | getImageElement() | 獲取元素的值。 |
| int | getMaxHeight() | 獲取 Image 對(duì)象的最大高度。 |
| int | getMaxWidth() | 獲取 Image 對(duì)象的最大寬度。 |
| PixelMap | getPixelMap() | 獲取此 Image 上顯示的 PixelMap 對(duì)象。 |
| PixelMapHolder | getPixelMapHolder() | 獲取此 Image 上顯示的 PixelMapHolder 對(duì)象。 |
| Image.ScaleMode | getScaleMode() | 獲取圖像縮放模式。 |
| void | setClipAlignment(int clipAlignment) | 設(shè)置剪裁對(duì)齊模式。 |
| void | setClipDirection(int clipDirection) | 設(shè)置圖像剪切方向。 |
| void | setClipGravity(int clipGravity) | 已棄用。 此更改從 API 版本 5 開始生效。由 setClipAlignment() 替換 |
| void | setCornerRadii(float[] radii) | 設(shè)置此圖像的每個(gè)圓角的半徑。 |
| void | setCornerRadius(float radius) | 為此圖像的四個(gè)圓角設(shè)置一個(gè)統(tǒng)一的半徑。 |
| void | setImageAndDecodeBounds(int resId) | 設(shè)置要顯示的圖片的資源ID,并對(duì)圖片進(jìn)行解碼。 |
| void | setImageElement(Element element) | 設(shè)置要為此圖像顯示的元素。 |
| void | setMaxHeight(int value) | 設(shè)置 Image 對(duì)象的最大高度。 |
| void | setMaxWidth(int value) | 設(shè)置 Image 對(duì)象的最大寬度。 |
| void | setPixelMap(int resId) | 設(shè)置要顯示的圖像的資源 ID。 |
| void | setPixelMap(PixelMap pixelMap) | 設(shè)置要在組件上顯示的圖像。 |
| void | setPixelMapHolder(PixelMapHolder pixelMapHolder) | 設(shè)置要為此 Image 顯示的 PixelMapHolder 對(duì)象。 |
| void | setScaleMode(Image.ScaleMode scaleMode) | 設(shè)置圖像的縮放模式。 |
| 從類 ohos.agp.components.Component 繼承的方法 |
|---|
| addDrawTask, addDrawTask, addScrolledListener, announceAccessibility, arrange, bindCornerMark, callOnClick, canScroll, clearFocus, createAnimatorProperty, disableFadeEffect, dispatchRestoreState, dispatchSaveState, draw, enableCornerMark, enableFadeEffect, enableSaveState, enableScrollBar, estimateSize, executeDoubleClick, executeLongClick, findComponentById, findComponentHolderById, 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, informConfigurationChanged, invalidate, isBoundaryFadeEffectEnable, isBoundToWindow, isClickable, isClipToContourEnabled, isComponentDisplayed, isEnabled, isFadeEffected, isFocusable, isFocused, isIdentityMatrix, isLongClickOn, isPressed, isRtl, isSaveStateEnabled, isScrollbarFadingOn, isScrollBarOn, isScrollbarOverlapEnabled, isSelected, isSoundEnable, isTouchFocusable, isVibrationEffectEnabled, notifyAccessibility, onAttributeConfigChanged, onDrag, 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 |
| 從類 java.lang.Object 繼承的方法 |
|---|
| clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
字段詳細(xì)信息
CLIP_DIRECTION_NOT_SET
public static final int CLIP_DIRECTION_NOT_SET
表示未設(shè)置的圖像剪切方向。
CLIP_GRAVITY_NOT_SET
public static final int CLIP_GRAVITY_NOT_SET
表示未設(shè)置的裁剪對(duì)齊模式。
CLIP_HORIZONTAL
public static final int CLIP_HORIZONTAL
表示水平剪裁模式。
CLIP_VERTICAL
public static final int CLIP_VERTICAL
表示垂直剪裁模式。
GRAVITY_BOTTOM
public static final int GRAVITY_BOTTOM
表示裁剪圖像的底部對(duì)齊方式。
GRAVITY_CENTER
public static final int GRAVITY_CENTER
表示裁剪圖像的居中對(duì)齊方式。
GRAVITY_LEFT
public static final int GRAVITY_LEFT
表示裁剪圖像的左對(duì)齊方式。
GRAVITY_RIGHT
public static final int GRAVITY_RIGHT
表示裁剪圖像的右對(duì)齊方式。
GRAVITY_TOP
public static final int GRAVITY_TOP
表示裁剪圖像的頂部對(duì)齊方式。
構(gòu)造函數(shù)詳細(xì)信息
Image
public Image(Context context)
默認(rèn)構(gòu)造函數(shù)用于使用默認(rèn)屬性集和樣式創(chuàng)建 Image 實(shí)例。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| context | 指示應(yīng)用程序上下文。 |
Image
public Image(Context context, AttrSet attrSet)
用于在 XML 文件解析后使用指定的屬性集和默認(rèn)樣式創(chuàng)建 Image 實(shí)例的構(gòu)造函數(shù)。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| context | 指示應(yīng)用程序上下文。 |
| attrSet | 指示要使用的屬性集。 |
Image
public Image(Context context, AttrSet attrSet, String styleName)
用于在 XML 文件解析后使用指定的屬性集和指定的樣式創(chuàng)建 Image 實(shí)例的構(gòu)造函數(shù)。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| context | 指示應(yīng)用程序上下文。 |
| attrSet | 指示要使用的屬性集。 |
| styleName | 指示要使用的樣式名稱。 |
方法詳情
setPixelMapHolder
public void setPixelMapHolder(PixelMapHolder pixelMapHolder)
設(shè)置要為此 Image 顯示的 PixelMapHolder 對(duì)象。
此方法在單線程中調(diào)用時(shí)可以比 setPixelMap(ohos.media.image.PixelMap) 更高效。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| pixelMapHolder | 表示圖像對(duì)象。 |
getPixelMapHolder
public PixelMapHolder getPixelMapHolder()
獲取此 Image 上顯示的 PixelMapHolder 對(duì)象。
返回:
返回此 Image 上顯示的 PixelMapHolder 對(duì)象。
setPixelMap
public void setPixelMap(PixelMap pixelMap)
設(shè)置要在組件上顯示的圖像。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| pixelMap | 表示圖像對(duì)象。 |
getPixelMap
public PixelMap getPixelMap()
獲取此 Image 上顯示的 PixelMap 對(duì)象。
返回:
返回此 Image 上顯示的 PixelMap 對(duì)象。
setImageElement
public void setImageElement(Element element)
設(shè)置要為此圖像顯示的元素。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| element | 指示要設(shè)置的元素。 |
getImageElement
public Element getImageElement()
獲取元素的值。
返回:
返回元素的值。
setImageAndDecodeBounds
public void setImageAndDecodeBounds(int resId)
設(shè)置要顯示的圖片的資源ID,并對(duì)圖片進(jìn)行解碼。
這個(gè)界面會(huì)根據(jù)組件的大小來(lái)縮放圖片。 使用此接口在不同組件上設(shè)置相同的資源 id 可能會(huì)導(dǎo)致其中一些顯示模糊。 請(qǐng)謹(jǐn)慎使用此界面。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| resId | 指示要顯示的圖像的資源 ID。 |
setPixelMap
public void setPixelMap(int resId)
設(shè)置要顯示的圖像的資源 ID。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| resId | 指示要顯示的圖像的資源 ID。 |
setClipDirection
public void setClipDirection(int clipDirection)
設(shè)置圖像剪切方向。
如果圖像的大小超過(guò)組件的大小,則可以水平或垂直裁剪圖像。 水平剪裁不會(huì)改變圖像的垂直內(nèi)容。 垂直裁剪不會(huì)改變圖像的水平內(nèi)容。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| clipDirection | 指定圖像剪切方向。 1表示CLIP_HORIZONTAL,即水平剪裁; 2 表示 CLIP_VERTICAL,即垂直裁剪。 |
getClipDirection
public int getClipDirection()
獲取圖像裁剪方向。
返回:
返回圖像剪切方向。
setClipGravity
@Deprecated public void setClipGravity(int clipGravity)
已棄用。 此更改從 API 版本 5 開始生效。由 setClipAlignment() 替換
設(shè)置剪裁對(duì)齊模式。
此方法設(shè)置裁剪對(duì)齊模式。 例如,如果該值為 GRAVITY_LEFT,則當(dāng)圖像的寬度超過(guò)組件的寬度時(shí),將裁剪圖像的右側(cè)部分。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| clipGravity | 使用 Image 中的靜態(tài)輔音指定剪切模式,例如 GRAVITY_LEFT。 |
getClipGravity
@Deprecated public int getClipGravity()
已棄用。 此更改從 API 版本 5 開始生效。由 getClipAlignment() 替換
獲取圖片裁剪對(duì)齊方式。
返回:
返回圖像裁剪對(duì)齊模式。
setClipAlignment
public void setClipAlignment(int clipAlignment)
設(shè)置剪裁對(duì)齊模式。
此方法設(shè)置裁剪對(duì)齊模式。 例如,如果該值為 GRAVITY_LEFT,則當(dāng)圖像的寬度超過(guò)組件的寬度時(shí),將裁剪圖像的右側(cè)部分。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| clipAlignment | 使用 Image 中的靜態(tài)輔音指定剪切模式,例如 GRAVITY_LEFT。 |
getClipAlignment
public int getClipAlignment()
獲取圖片裁剪對(duì)齊方式。
返回:
返回圖像裁剪對(duì)齊模式。
setScaleMode
public void setScaleMode(Image.ScaleMode scaleMode)
設(shè)置圖像的縮放模式。
當(dāng)圖像和組件的大小不同時(shí),此方法對(duì)圖像進(jìn)行縮放或裁剪。 有關(guān)縮放模式的詳細(xì)信息,請(qǐng)參見 ScaleMode。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| scaleMode | ScaleMode枚舉值,指定縮放模式。 |
getScaleMode
public Image.ScaleMode getScaleMode()
獲取圖像縮放模式。
返回:
返回圖像縮放模式。
setCornerRadius
public void setCornerRadius(float radius)
為此圖像的四個(gè)圓角設(shè)置一個(gè)統(tǒng)一的半徑。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| radius | 表示要設(shè)置的半徑。 該參數(shù)的值必須大于0,小于等于0則設(shè)置無(wú)效。 |
getCornerRadius
public float getCornerRadius()
獲取圓角半徑。
返回:
以浮點(diǎn)數(shù)返回半徑。
setCornerRadii
public void setCornerRadii(float[] radii)
設(shè)置此圖像的每個(gè)圓角的半徑。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| radii | 指示要設(shè)置的半徑數(shù)組。 |
getCornerRadii
public float[] getCornerRadii()
獲得四個(gè)角的半徑。
返回:
以浮點(diǎn)數(shù)返回半徑。
setMaxHeight
public void setMaxHeight(int value)
設(shè)置 Image 對(duì)象的最大高度。
僅當(dāng) Image 對(duì)象的高度設(shè)置為 MATCH_CONTENT 時(shí)才使用此方法。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| value | 表示 Image 對(duì)象的最大高度。 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果指定的高度小于 0,則拋出此異常。 |
getMaxHeight
public int getMaxHeight()
獲取 Image 對(duì)象的最大高度。
返回:
返回 Image 對(duì)象的最大高度。
setMaxWidth
public void setMaxWidth(int value)
設(shè)置 Image 對(duì)象的最大寬度。
僅當(dāng) Image 對(duì)象的寬度設(shè)置為 MATCH_CONTENT 時(shí)才使用此方法。
參數(shù):
| 參數(shù)名稱 | 參數(shù)描述 |
|---|---|
| value | 表示 Image 對(duì)象的最大寬度。 |
Throws:
| Throw名稱 | Throw描述 |
|---|---|
| IllegalArgumentException | 如果指定的寬度小于 0,則拋出此異常。 |
getMaxWidth
public int getMaxWidth()
獲取 Image 對(duì)象的最大寬度。
返回:
返回 Image 對(duì)象的最大寬度。
分享名稱:創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OSImage
路徑分享:http://www.dlmjj.cn/article/cdosgcs.html


咨詢
建站咨詢
