PageComponent练习

PageComponent为定义创建一个内容页层,可以快速、方便的进行页面创建,且自动支持滑动翻页效果。

代码如下:

Page = new PageComponent

width: Screen.width

height: Screen.height

scrollVertical: false

Layer1 = new Layer

width: Page.width

height: Page.height

superLayer: Page.content

x:0

y:0

image: "images/1.png"

Layer2 = new Layer

width: Page.width

height: Page.height

superLayer: Page.content

x:Page.width

y:0

image: "images/2.png"

Layer3 = new Layer

width: Page.width

height: Page.height

superLayer: Page.content

x:Page.width * 2

y:0

image: "images/3.png"

Layer4 = new Layer

width: Page.width

height: Page.height

superLayer: Page.content

x:Page.width * 3

y:0

image: "images/4.png"

#按钮定义

Button1 = new Layer

width: Page.width/4

height:100

x:0

y:Page.height - 100

opacity: 0

Button2 = new Layer

width: Page.width/4

height:100

x:Page.width/4

y:Page.height - 100

opacity: 0

Button3 = new Layer

width: Page.width/4

height:100

x:Page.width/2

y:Page.height - 100

opacity: 0

Button4 = new Layer

width: Page.width/4

height:100

x:Page.width/2+Page.width/4

y:Page.height - 100

opacity: 0

#定义菜单切换按钮

Button1.on Events.Click, ->

Page.snapToPage(Layer1) //snapToPage() 跳转到指定的Page

Button2.on Events.Click, ->

Page.snapToPage(Layer2)

Button3.on Events.Click, ->

Page.snapToPage(Layer3)

Button4.on Events.Click, ->

Page.snapToPage(Layer4)

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • Correctness AdapterViewChildren Summary: AdapterViews can...
    MarcusMa阅读 12,872评论 0 6
  • afinalAfinal是一个android的ioc,orm框架 https://github.com/yangf...
    passiontim阅读 15,749评论 2 45
  • 你付真情 他作假意 你看的真切 却还继续做戏 白骨精的拙劣表演 唯有唐僧看不厌 而你的表演 无人观赏 到底是你害怕...
    慵懒小兽阅读 1,697评论 1 0
  • 当明天变成了今天成为了昨天,最后成为记忆里不再重要的某一天,我们会突然发现自己在不知不觉中已被时间推着向前走。 在...
    pennyli8765阅读 1,603评论 0 0
  • 晚来雨急凭空寄,在途虚应诺诺吁。曾喜扪窗独听雨,今厌行远憎别离。这么回事儿:老婆微信告诉我,家里下雨你知道吗,挺讨...
    tea106阅读 1,315评论 0 0

友情链接更多精彩内容