温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

Egret之egret.ScrollView

发布时间:2020-07-05 03:04:43 来源:网络 阅读:1501 作者:Aonaufly 栏目:开发技术

由于在微信小游戏中,无法使用eui框架(即无法使用eui.Scroller) . 还好egret框架内提供了egret.ScrollView可以完美替代.

一 : 申明及初始化

private _scrollview : egret.ScrollView = null;
this._scrollview = new egret.ScrollView();

二:选择显示容器

this._scrollview.setContent( this._list_con );

二-1 : private _list_con : egret.DisplayObjectContainer = null;

三:设置位置及SIZE

this._scrollview.x = ( ( this._UI_SZ.x - this._content_bg.width ) >> 1 ) + 13;
this._scrollview.y = 101.5;
this._scrollview.width = this._content_size.x;
this._scrollview.height = this._content_size.y;

四:设置滚动方案

this._scrollview.verticalScrollPolicy = "on";
this._scrollview.horizontalScrollPolicy = "off";

四-1 : 此代码为在竖直方向上滚动 , 在水平方向上不滚动

五:加入到显示容器

this.addChild( this._scrollview );

六:手动设置滚动的距离

this._scrollview.scrollTop = 0;
向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI