日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 人文社科 > 生活经验 >内容正文

生活经验

HarmonyOS ScrollView 使用

發布時間:2023/11/27 生活经验 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 HarmonyOS ScrollView 使用 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

ScrollView 介紹

ScrollView是一種帶滾動功能的組件,它采用滑動的方式在有限的區域內顯示更多的內容。

本來很簡單的不打算記錄,但是各種坑啊,哎.現在學習大致了解就行,

ScrollView的自有XML屬性

1?match_viewport?是否拉伸匹配 默認為false

2?rebound_effect?回彈效果 默認為false

下面吐槽下這2個屬性

match_viewport?這個屬性感覺有bug ,說下感受呢,當ScrollView 不設置屬性時候,無論是文字還是圖片當寬度大于屏幕的寬度的時候,設置ScrollView為水平滾動的方向,但是這個時候左右也是可以滑動的如果不理解看下面的效果圖

?這個時候設置match_viewport 為true 就不存這個問題,設置之后圖片子組件填充滿ScrollView

?但是卻怎么也不滑動了,希望后面能修復吧,或者就是自己其他的地方沒有設置

2?rebound_effect? 這個屬性設置回彈,設置之后有回彈但是不能滾動了,這里就上傳gif圖片了

錄制了2個現在csdn有限制大小總是上傳不了.

ScrollView 使用注意

ScrollView 屬性里面字內容不能有多個否則也滑動不了,所以可以在字內容外寫一個布局包含

要滑動的內容一般都是使用DirectionalLayout 相當于線性布局,通過設置orientation來控制是

垂直滑動還是水平滑動

垂直滑動

<?xml version="1.0" encoding="utf-8"?>
<ScrollViewxmlns:ohos="http://schemas.huawei.com/res/ohos"ohos:height="match_parent"ohos:width="match_parent"ohos:id="$+id:scroll"><DirectionalLayoutohos:height="match_content"ohos:width="match_content"ohos:orientation="vertical"><Imageohos:width="match_parent"ohos:height="200vp"ohos:scale_mode="clip_center"ohos:image_src="$media:three"/><Imageohos:width="match_parent"ohos:height="200vp"ohos:scale_mode="clip_center"ohos:image_src="$media:three"/><Imageohos:width="match_parent"ohos:height="200vp"ohos:top_margin="16vp"ohos:scale_mode="clip_center"ohos:image_src="$media:three"/><Imageohos:width="match_parent"ohos:height="200vp"ohos:top_margin="16vp"ohos:scale_mode="clip_center"ohos:image_src="$media:three"/><Imageohos:width="match_parent"ohos:height="200vp"ohos:top_margin="16vp"ohos:scale_mode="clip_center"ohos:image_src="$media:three"/><Imageohos:width="match_parent"ohos:height="200vp"ohos:top_margin="16vp"ohos:scale_mode="clip_center"ohos:image_src="$media:three"/><Imageohos:width="match_parent"ohos:height="200vp"ohos:top_margin="16vp"ohos:scale_mode="clip_center"ohos:image_src="$media:three"/></DirectionalLayout>
</ScrollView>

水平滑動

<?xml version="1.0" encoding="utf-8"?>
<ScrollViewxmlns:ohos="http://schemas.huawei.com/res/ohos"ohos:height="match_parent"ohos:width="match_parent"ohos:id="$+id:scroll"><DirectionalLayoutohos:height="match_content"ohos:width="match_content"ohos:orientation="horizontal"><Imageohos:width="match_parent"ohos:height="200vp"ohos:scale_mode="clip_center"ohos:image_src="$media:three"/><Imageohos:width="match_parent"ohos:height="200vp"ohos:scale_mode="clip_center"ohos:image_src="$media:three"/><Imageohos:width="match_parent"ohos:height="200vp"ohos:top_margin="16vp"ohos:scale_mode="clip_center"ohos:image_src="$media:three"/><Imageohos:width="match_parent"ohos:height="200vp"ohos:top_margin="16vp"ohos:scale_mode="clip_center"ohos:image_src="$media:three"/><Imageohos:width="match_parent"ohos:height="200vp"ohos:top_margin="16vp"ohos:scale_mode="clip_center"ohos:image_src="$media:three"/><Imageohos:width="match_parent"ohos:height="200vp"ohos:top_margin="16vp"ohos:scale_mode="clip_center"ohos:image_src="$media:three"/><Imageohos:width="match_parent"ohos:height="200vp"ohos:top_margin="16vp"ohos:scale_mode="clip_center"ohos:image_src="$media:three"/></DirectionalLayout>
</ScrollView>

ScrollView的速度、滾動、回彈等常用接口

方法

作用

doFling(int velocityX, int velocityY)

doFlingX(int velocityX)

doFlingY(int velocityY)

設置X軸和Y軸滾動的初始速度,單位(px)

fluentScrollBy(int dx, int dy)

fluentScrollByX(int dx)

fluentScrollByY(int dy)

沿坐標軸將內容平滑地移動指定數量的像素,單位(px)

fluentScrollTo(int x, int y)

fluentScrollXTo(int x)

fluentScrollYTo(int y)

根據指定坐標平滑滾動到指定位置,單位(px)

setReboundEffect(boolean enabled)

設置是否啟用回彈效果,默認false

setReboundEffectParams(int overscrollPercent, float overscrollRate, int remainVisiblePercent)

setReboundEffectParams(ReboundEffectParams reboundEffectParams)

setOverscrollPercent(int overscrollPercent)

setOverscrollRate(float overscrollRate)

setRemainVisiblePercent(int remainVisiblePercent)

配置回彈效果

overscrollPercent:過度滾動百分比,默認值40

overscrollRate:過度滾動率,默認值0.6

remainVisiblePercent:應保持可見內容的最小百分比,默認值20

?官方參考地址

總結

以上是生活随笔為你收集整理的HarmonyOS ScrollView 使用的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。

主站蜘蛛池模板: 99久久久国产精品免费蜜臀 | 久热免费在线视频 | 亚洲激情久久久 | 999精品网站 | 伦一理一级一a一片 | 9l视频自拍蝌蚪9l视频成人 | 超黄网站在线观看 | 欧美一级一区 | 欧洲精品二区 | 日韩高清在线一区 | 国产尤物视频在线观看 | 老妇女玩小男生毛片 | 欧美一区二区三区日韩 | 欧美一区二区三区影视 | 久久久6 | 在线免费黄色网 | 国产字幕在线观看 | 天天av天天操 | www成人免费 | 日韩久久久久久 | 91精品国产99久久久久久 | 国产一级特黄aaa大片 | www.天堂av | 中文字幕 视频一区 | 电影《走路上学》免费 | 嫩草影院在线观看视频 | 亚洲在线视频观看 | 尹人久久 | 十大污网站| 制服丝袜av在线 | 亚洲一线二线在线观看 | 无码人妻精品一区二区三区99不卡 | 日本综合在线 | 网站av| 天堂av免费在线 | 久久网页 | 欧美特黄aaa| 日韩精品第一页 | 欧美精品123区 | 久久久国产精品成人免费 | 久久久久香蕉 | 日韩a级片在线观看 | 免费成人高清在线视频 | √资源天堂中文在线 | 婷婷激情视频 | 手机在线毛片 | 欧美日韩高清一区二区三区 | 永久免费精品 | 午夜福利视频 | 欧美日韩在线精品 | 精品国精品国产 | 国产在线视视频有精品 | 亚洲综合一区在线 | 成年人免费黄色片 | 日本在线看片 | www.youjizz.com在线 | 禁断介护老人中文字幕 | 91久久国语露脸精品国产高跟 | 天天爽网站 | 鲁啊鲁在线视频 | 男女av网站 | 一久久久久 | 一区二区三区韩国 | 老熟女毛茸茸浓毛 | 91麻豆国产在线 | 精品久久一区二区三区 | 丰满岳乱妇一区二区 | 亚洲美女自拍视频 | 日韩一区二区视频在线播放 | 夜夜爽av福利精品导航 | 最新国产精品 | 性色在线 | 麻豆网站在线看 | 91精品国产欧美一区二区成人 | 最近中文字幕在线mv视频在线 | 亚洲久久久久久 | av有声小说一区二区三区 | 91亚洲精品在线 | 最新版天堂资源在线 | 国产浪潮av | 少女与动物高清版在线观看 | 男人私人影院 | 在线免费福利 | 欧美日韩a级 | 国产免费黄色小视频 | 东方av在线播放 | 久久都是精品 | 樱桃视频一区二区三区 | 日韩精品一区二区三区免费视频 | 天堂综合 | 五月天色综合 | 欧美精品一区二区成人 | 色婷婷丁香 | 涩涩亚洲 | 欧美成人午夜免费视在线看片 | 男男大尺度 | 娇妻第一次尝试交换的后果 | 亚洲一区二区乱码 | 国产精品天美传媒 |