Corona的newScrollView隐藏滚动条但仍显示滚动条。
2014-6-30 14:9:23
收藏:0
阅读:73
评论:2
我像这样声明了一个 Scroll View:
sv = widget.newScrollView{
top = properties.y,
left = properties.x,
width = properties.moreGamesPanelWidth,
height = properties.height,
scrollWidth = properties.moreGamesPanelWidth,
scrollHeight = lg.contentHeight,
hideBackground = true,
isBounceEnabled = false,
horizontalScrollDisabled = true,
isLocked = lock,
listener = widgetTouchListener,
hideScrollBar = true,
}
不幸的是,无论我在 "hideScrollBar" 中设置什么,滚动条仍然可见。 有没有可能隐藏滚动条?
点赞
用户3173910
问题在于 Corona 的文档是错误的,设置滚动条可见性的属性不是 hideScrollBar = false,而是 autoHideScrollBar = false。
让我困惑了好几天!
2016-10-12 08:43:59
评论区的留言会收到邮件通知哦~
推荐文章
- 如何将两个不同的lua文件合成一个 东西有点长 大佬请耐心看完 我是小白研究几天了都没搞定
- 如何在roblox studio中1:1导入真实世界的地形?
- 求解,lua_resume的第二次调用继续执行协程问题。
- 【上海普陀区】内向猫网络招募【Skynet游戏框架Lua后端程序员】
- SF爱好求教:如何用lua实现游戏内调用数据库函数实现账号密码注册?
- Lua实现网站后台开发
- LUA错误显式返回,社区常见的规约是怎么样的
- lua5.3下载库失败
- 请问如何实现文本框内容和某个网页搜索框内容连接,并把网页输出来的结果反馈到另外一个文本框上
- lua lanes多线程使用
- 一个kv数据库
- openresty 有没有比较轻量的 docker 镜像
- 想问一下,有大佬用过luacurl吗
- 在Lua执行过程中使用Load函数出现问题
- 为什么 neovim 里没有显示一些特殊字符?
- Lua比较两个表的值(不考虑键的顺序)
- 有个lua简单的项目,外包,有意者加微信 liuheng600456详谈,最好在成都
- 如何在 Visual Studio 2022 中运行 Lua 代码?
- addEventListener 返回 nil Lua
- Lua中获取用户配置主目录的跨平台方法
我发现了一个问题!
当你声明两个或更多的 scrollViews 时,问题就会发生。最后一个 scrollView 会覆盖“hideScrollBar”设置。因此没有选项可以有两个 scrollViews,一个带有滚动条,一个没有。
以下是用代码证明这个问题:
properties.lua
local properties = {} -- 设备尺寸 properties.width = display.contentWidth + display.screenOriginX * -2 properties.height = display.contentHeight + display.screenOriginY * -2 properties.x = display.screenOriginX properties.y = display.screenOriginY properties.center = { x = properties.x + properties.width / 2, y = properties.y + properties.height / 2 } return propertiesmain.lua
display.setStatusBar( display.HiddenStatusBar ) local properties = require("properties") local widget = require("widget") local sceneGroup = display.newGroup() local lg = display.newGroup() local lg2 = display.newGroup() local bg = display.newRect(properties.center.x, properties.center.y, properties.width, properties.height) bg:setFillColor(0.2, 0.2, 0.1) sceneGroup:insert(bg) local menuRect1 = display.newRect(100, 50, 200, 100) menuRect1:setFillColor(0.8, 0.1, 0.1) lg:insert(menuRect1) local menuRect2 = display.newRect(100, 160, 200, 100) menuRect2:setFillColor(0.1, 0.1, 0.9) lg:insert(menuRect2) local menuRect11 = display.newRect(100, 50, 200, 100) menuRect11:setFillColor(0.8, 0.1, 0.1) lg2:insert(menuRect11) local menuRect22 = display.newRect(100, 160, 200, 100) menuRect22:setFillColor(0.1, 0.1, 0.9) lg2:insert(menuRect22) local sv local sv2 sv = widget.newScrollView{ top = properties.center.y - lg.contentHeight * 0.5 - 100, left = properties.center.x - lg.contentWidth * 0.5, width = lg.contentWidth +20, height = lg.contentHeight -80 , scrollHeight = lg.contentHeight, hideBackground = true, isBounceEnabled = false, hideScrollBar = true, horizontalScrollDisabled = true, isLocked = false, } sv2 = widget.newScrollView{ top = properties.center.y - lg.contentHeight * 0.5 + 100, left = properties.center.x - lg.contentWidth * 0.5 , width = lg.contentWidth +20, height = lg.contentHeight -80 , scrollHeight = lg.contentHeight, hideBackground = true, isBounceEnabled = false, hideScrollBar = false, horizontalScrollDisabled = true, isLocked = false, } sv:insert(lg) sv2:insert(lg2) sceneGroup:insert(sv) sceneGroup:insert(sv2)