日韩无码专区无码一级三级片|91人人爱网站中日韩无码电影|厨房大战丰满熟妇|AV高清无码在线免费观看|另类AV日韩少妇熟女|中文日本大黄一级黄色片|色情在线视频免费|亚洲成人特黄a片|黄片wwwav色图欧美|欧亚乱色一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OSPageSlider

PageSlider

創(chuàng)新互聯(lián)是一家專業(yè)提供海倫企業(yè)網(wǎng)站建設(shè),專注與成都網(wǎng)站設(shè)計、網(wǎng)站建設(shè)、H5場景定制、小程序制作等業(yè)務(wù)。10年已為海倫眾多企業(yè)、政府機(jī)構(gòu)等服務(wù)。創(chuàng)新互聯(lián)專業(yè)的建站公司優(yōu)惠進(jìn)行中。

java.lang.Object

|---ohos.agp.components.Component

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

|---|---|---ohos.agp.components.StackLayout

|---|---|---|---ohos.agp.components.PageSlider

public class PageSlider
extends StackLayout

一個布局管理器,允許用戶左右滑動以及上下滑動來翻頁。

作為一個容器類,它允許您添加其他組件。 必須設(shè)置 PageSliderProvider 以生成組件顯示的頁面。

Since:

3

嵌套類摘要

修飾符和類型 描述
static interfacePageSlider.PageChangedListener提供一個監(jiān)聽器來觀察頁面變化事件。
static classPageSlider.ReboundEffectParams表示回彈效果參數(shù)。
從類 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.StackLayout 繼承的嵌套類/接口
StackLayout.LayoutConfig

字段摘要

修飾符和類型 字段 描述
static intDEFAULT_CACHED_PAGES_LIMIT指示要在當(dāng)前頁面的任一側(cè)保留的最小頁面數(shù)。
static intINVALID_INDEX表示無效的位置。
static floatROTATION_SENSITIVITY_DEFAULT指示 PageSlider 響應(yīng)旋轉(zhuǎn)表冠事件的默認(rèn)旋轉(zhuǎn)靈敏度。
static floatROTATION_SENSITIVITY_HIGH指示 PageSlider 響應(yīng)旋轉(zhuǎn)表冠事件的高旋轉(zhuǎn)靈敏度。
static floatROTATION_SENSITIVITY_LOW指示 PageSlider 響應(yīng)旋轉(zhuǎn)表冠事件的低旋轉(zhuǎn)靈敏度。
static intSLIDING_STATE_DRAGGING表示用戶當(dāng)前正在瀏覽頁面。
static intSLIDING_STATE_IDLE表示當(dāng)前頁面完全在組件中,并且沒有動畫正在進(jìn)行中。
static intSLIDING_STATE_SETTLING表示頁面已滾動到最終位置。
從類 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

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

構(gòu)造函數(shù) 描述
PageSlider(Context context)用于使用默認(rèn)屬性集和樣式創(chuàng)建 PageSlider 實(shí)例的默認(rèn)構(gòu)造函數(shù)。
PageSlider(Context context, AttrSet attrSet)用于在解析 XML 文件后使用指定的屬性集和默認(rèn)樣式創(chuàng)建 PageSlider 實(shí)例的構(gòu)造函數(shù)。
PageSlider(Context context, AttrSet attrSet, String styleName)用于在 XML 文件解析后使用指定的屬性集和指定的樣式創(chuàng)建 PageSlider 實(shí)例的構(gòu)造函數(shù)。

方法總結(jié)

修飾符和類型 方法 描述
voidaddPageChangedListener(PageSlider.PageChangedListener listener)注冊一個監(jiān)聽頁面更改事件的監(jiān)聽器。
intgetCachedPagesLimit()獲取當(dāng)前頁面兩側(cè)要保留的頁面數(shù)。
intgetCurrentPage()獲取選中的頁面。
intgetCurrentSlidingState()獲取當(dāng)前的滑動狀態(tài)。
intgetOrientation()獲取頁面滑動方向,可以是Component.HORIZONTAL或Component.VERTICAL。
intgetPageMargin()獲取頁面之間的邊距。
intgetPageSwitchTime()獲取頁面切換時間。
PageSliderProvidergetProvider()獲取為當(dāng)前頁面提供組件的分頁適配器。
booleangetReboundEffect()獲取反彈效果的狀態(tài)。
PageSlider.ReboundEffectParamsgetReboundEffectParams()獲取反彈參數(shù)作為 ReboundEffectParams 對象。
booleangetSlidingPossible()獲取是否開啟頁面滑動。
booleanisCircularModeEnabled()檢查是否為 PageSlider 啟用了循環(huán)模式。
voidremovePageChangedListener(PageSlider.PageChangedListener listener)刪除以前注冊的頁面更改偵聽器。
voidsetCircularModeEnabled(boolean enabled)設(shè)置是否為 PageSlider 啟用循環(huán)模式。
voidsetCurrentPage(int itemPos)設(shè)置選定的頁面。
voidsetCurrentPage(int itemPos, boolean smoothScroll)設(shè)置當(dāng)前選擇的頁面。
voidsetOrientation(int orientation)設(shè)置頁面滑動方向,可以是Component.HORIZONTAL或Component.VERTICAL。
voidsetPageCacheSize(int cacheSize)設(shè)置要保留在當(dāng)前頁面兩側(cè)的頁面數(shù)。
voidsetPageMargin(int margin)設(shè)置頁面之間的邊距。
voidsetPageSwitchTime(int durationMs)設(shè)置頁面切換時間。
voidsetProvider(PageSliderProvider provider)設(shè)置為當(dāng)前頁面提供組件的尋呼機(jī)適配器。
voidsetReboundEffect(boolean enabled)設(shè)置是否開啟反彈效果。
voidsetReboundEffectParams(int overscrollPercent, float overscrollRate, int remainVisiblePercent)配置回彈效果參數(shù)。
voidsetReboundEffectParams(PageSlider.ReboundEffectParams reboundEffectParams)設(shè)置回彈效果參數(shù)。
voidsetSlidingPossible(boolean enable)設(shè)置是否開啟頁面滑動。
從類 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
從類 ohos.agp.components.StackLayout 繼承的方法
createLayoutConfig, verifyLayoutConfig

字段詳細(xì)信息

DEFAULT_CACHED_PAGES_LIMIT

public static final int DEFAULT_CACHED_PAGES_LIMIT

指示要在當(dāng)前頁面的任一側(cè)保留的最小頁面數(shù)。 默認(rèn)值為 1。

INVALID_INDEX

public static final int INVALID_INDEX

表示無效的位置。 有效位置的數(shù)量比當(dāng)前適配器中的項目總數(shù)少 0 到 1。

ROTATION_SENSITIVITY_DEFAULT

public static final float ROTATION_SENSITIVITY_DEFAULT

指示 PageSlider 響應(yīng)旋轉(zhuǎn)表冠事件的默認(rèn)旋轉(zhuǎn)靈敏度。 您可以使用 Component.setRotationSensitivity(float) 進(jìn)行設(shè)置。

ROTATION_SENSITIVITY_HIGH

public static final float ROTATION_SENSITIVITY_HIGH

指示 PageSlider 響應(yīng)旋轉(zhuǎn)表冠事件的高旋轉(zhuǎn)靈敏度。 您可以使用 Component.setRotationSensitivity(float) 進(jìn)行設(shè)置。

ROTATION_SENSITIVITY_LOW

public static final float ROTATION_SENSITIVITY_LOW

指示 PageSlider 響應(yīng)旋轉(zhuǎn)表冠事件的低旋轉(zhuǎn)靈敏度。 您可以使用 Component.setRotationSensitivity(float) 進(jìn)行設(shè)置。

SLIDING_STATE_DRAGGING

public static final int SLIDING_STATE_DRAGGING

表示用戶當(dāng)前正在瀏覽頁面。

SLIDING_STATE_IDLE

public static final int SLIDING_STATE_IDLE

表示當(dāng)前頁面完全在組件中,并且沒有動畫正在進(jìn)行中。

SLIDING_STATE_SETTLING

public static final int SLIDING_STATE_SETTLING

表示頁面已滾動到最終位置。

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

PageSlider

public PageSlider(Context context)

用于使用默認(rèn)屬性集和樣式創(chuàng)建 PageSlider 實(shí)例的默認(rèn)構(gòu)造函數(shù)。

參數(shù):

參數(shù)名稱 參數(shù)描述
context指示應(yīng)用程序上下文。

PageSlider

public PageSlider(Context context, AttrSet attrSet)

用于在解析 XML 文件后使用指定的屬性集和默認(rèn)樣式創(chuàng)建 PageSlider 實(shí)例的構(gòu)造函數(shù)。

參數(shù):

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

PageSlider

public PageSlider(Context context, AttrSet attrSet, String styleName)

用于在 XML 文件解析后使用指定的屬性集和指定的樣式創(chuàng)建 PageSlider 實(shí)例的構(gòu)造函數(shù)。

參數(shù):

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

方法詳情

setProvider

public void setProvider(PageSliderProvider provider)

設(shè)置為當(dāng)前頁面提供組件的尋呼機(jī)適配器。

參數(shù):

參數(shù)名稱 參數(shù)描述
provider指示尋呼機(jī)適配器。

getProvider

public PageSliderProvider getProvider()

獲取為當(dāng)前頁面提供組件的分頁適配器。

返回:

如果有,則返回分配的尋呼適配器; 否則返回 null。

getCurrentPage

public int getCurrentPage()

獲取選中的頁面。

返回:

返回所選頁面底部的頁面索引; 如果沒有分配尋呼機(jī)適配器,則返回 INVALID_INDEX。

addPageChangedListener

public void addPageChangedListener(PageSlider.PageChangedListener listener)

注冊一個監(jiān)聽頁面更改事件的監(jiān)聽器。

參數(shù):

參數(shù)名稱 參數(shù)描述
listener指示頁面更改偵聽器。

Throws:

Throw名稱 Throw描述
IllegalArgumentException如果 listener 為空。

Since:

4

removePageChangedListener

public void removePageChangedListener(PageSlider.PageChangedListener listener)

刪除以前注冊的頁面更改偵聽器。

參數(shù):

參數(shù)名稱 參數(shù)描述
listener指示頁面更改偵聽器。

Throws:

Throw名稱 Throw描述
IllegalArgumentException如果 listener 為空。

Since:

4

getCurrentSlidingState

public int getCurrentSlidingState()

獲取當(dāng)前的滑動狀態(tài)。

返回:

返回當(dāng)前滑動狀態(tài),SLIDING_STATE_IDLE、SLIDING_STATE_DRAGGING、SLIDING_STATE_SETTLING 之一。

setOrientation

public void setOrientation(int orientation)

設(shè)置頁面滑動方向,可以是Component.HORIZONTAL或Component.VERTICAL。

默認(rèn)情況下,頁面在水平方向滑動。

參數(shù):

參數(shù)名稱 參數(shù)描述
orientation指示頁面滑動方向。

Throws:

Throw名稱 Throw描述
IllegalArgumentException如果方向既不是 Component.HORIZONTAL 也不是 Component.VERTICAL。

getOrientation

public int getOrientation()

獲取頁面滑動方向,可以是Component.HORIZONTAL或Component.VERTICAL。 默認(rèn)情況下,頁面在水平方向滑動。

返回:

返回頁面滑動方向,默認(rèn)為 Component.HORIZONTAL。

setPageMargin

public void setPageMargin(int margin)

設(shè)置頁面之間的邊距。

參數(shù):

參數(shù)名稱 參數(shù)描述
margin指示頁面之間的邊距,以像素為單位。

Since:

5

getPageMargin

public int getPageMargin()

獲取頁面之間的邊距。

返回:

margin 返回頁面之間的邊距,以像素為單位。

Since:

5

setPageCacheSize

public void setPageCacheSize(int cacheSize)

設(shè)置要保留在當(dāng)前頁面兩側(cè)的頁面數(shù)。

參數(shù):

參數(shù)名稱 參數(shù)描述
cacheSize指示要在當(dāng)前頁面的任一側(cè)保留的頁面數(shù)。

Throws:

Throw名稱 Throw描述
IllegalArgumentException如果 count <= 0。

Since:

4

getCachedPagesLimit

public int getCachedPagesLimit()

獲取當(dāng)前頁面兩側(cè)要保留的頁面數(shù)。

返回:

返回要保留在當(dāng)前頁面兩側(cè)的頁面數(shù)。

setCurrentPage

public void setCurrentPage(int itemPos)

設(shè)置選定的頁面。

參數(shù):

參數(shù)名稱 參數(shù)描述
itemPos表示所選頁面的位置索引。

Throws:

Throw名稱 Throw描述
IllegalArgumentException如果 itemPos < 0。

setCurrentPage

public void setCurrentPage(int itemPos, boolean smoothScroll)

設(shè)置當(dāng)前選擇的頁面。

參數(shù):

參數(shù)名稱 參數(shù)描述
itemPos要選擇的頁面索引。
smoothScroll是一種模式:true 表示平滑滾動,false 表示立即滾動。

Throws:

Throw名稱 Throw描述
IllegalArgumentException如果 itemPos < 0。

setSlidingPossible

public void setSlidingPossible(boolean enable)

設(shè)置是否開啟頁面滑動。

參數(shù):

參數(shù)名稱 參數(shù)描述
enabletrue 表示開啟頁面滑動; false 表示其他情況。

getSlidingPossible

public boolean getSlidingPossible()

獲取是否開啟頁面滑動。 默認(rèn)情況下,頁面滑動是啟用的。

返回:

如果啟用了頁面滑動,則返回 true; 否則返回 false。

setCircularModeEnabled

public void setCircularModeEnabled(boolean enabled)

設(shè)置是否為 PageSlider 啟用循環(huán)模式。

應(yīng)用循環(huán)模式后,PageSlider 中的頁面將在用戶滑動時循環(huán)顯示。 也就是說,當(dāng)用戶從最后一頁滑動得更遠(yuǎn)時,將顯示第一頁,反之亦然。

參數(shù):

參數(shù)名稱 參數(shù)描述
enabled指定是否啟用循環(huán)模式。

Since:

5

isCircularModeEnabled

public boolean isCircularModeEnabled()

檢查是否為 PageSlider 啟用了循環(huán)模式。

返回:

如果啟用循環(huán)模式,則返回 true; 否則返回 false。

Since:

5

setReboundEffect

public void setReboundEffect(boolean enabled)

設(shè)置是否開啟反彈效果。

參數(shù):

參數(shù)名稱 參數(shù)描述
enabled指定是否啟用反彈效果。 true 表示開啟反彈效果; false 表示關(guān)閉反彈效果。

getReboundEffect

public boolean getReboundEffect()

獲取反彈效果的狀態(tài)。

返回:

如果啟用了反彈效果,則返回 true; 否則返回 false。

setReboundEffectParams

public void setReboundEffectParams(int overscrollPercent, float overscrollRate, int remainVisiblePercent)

配置回彈效果參數(shù)。

參數(shù):

參數(shù)名稱 參數(shù)描述
overscrollPercent表示過度滾動百分比(默認(rèn)值:40)。 如果滾動內(nèi)容的百分比超過該參數(shù)的值,則內(nèi)容滾動速度受 overscrollRate 參數(shù)的影響。 具體來說,如果 overscrollRate 的值小于 1.0,則您的手指移動速度快于內(nèi)容。
overscrollRate表示過度滾動率(默認(rèn)值:0.6)。 如果滾動內(nèi)容的百分比超過 overscrollPercent 參數(shù)的值,此參數(shù)會影響內(nèi)容滾動速度。 具體來說,內(nèi)容滾動速度等于手指滾動速度乘以overscrollRate的值。
remainVisiblePercent指示在過度滾動期間應(yīng)保持可見的可滾動內(nèi)容的最小百分比。 默認(rèn)值為 20。

Throws:

Throw名稱 Throw描述
IllegalArgumentException如果至少滿足以下條件之一: (1) overscrollPercent 不在 [0, 100] 范圍內(nèi) (2) overscrollRate <= 0 (3)保持可見百分比不在 [0, 100] 范圍內(nèi)

Since:

4

setReboundEffectParams

public void setReboundEffectParams(PageSlider.ReboundEffectParams reboundEffectParams)

設(shè)置回彈效果參數(shù)。

參數(shù):

參數(shù)名稱 參數(shù)描述
reboundEffectParams表示一個包含反彈效果參數(shù)的 ReboundEffectParams 對象。

Throws:

Throw名稱 Throw描述
IllegalArgumentException如果反彈效果參數(shù)為空或包含無效值。

Since:

4

getReboundEffectParams

public PageSlider.ReboundEffectParams getReboundEffectParams()

獲取反彈參數(shù)作為 ReboundEffectParams 對象。

返回:

返回包含反彈參數(shù)的 ReboundEffectParams 對象。

Since:

4

setPageSwitchTime

public void setPageSwitchTime(int durationMs)

設(shè)置頁面切換時間。

在通過 API 選擇頁面或用于結(jié)算頁面的情況下,PageSlider 移動具有此值的頁面。 默認(rèn)情況下,頁面切換時間為 300ms。 如果為 0 或負(fù)值,則將使用默認(rèn)值。

參數(shù):

參數(shù)名稱 參數(shù)描述
durationMs表示頁面切換,時間以毫秒為單位。

Since:

4

getPageSwitchTime

public int getPageSwitchTime()

獲取頁面切換時間。

返回:

頁面切換時間,以毫秒為單位。

Since:

4


本文標(biāo)題:創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OSPageSlider
轉(zhuǎn)載來源:http://m.5511xx.com/article/djgghdo.html