我正在处理将在屏幕顶部打开的水平菜单。 布局类似于以下内容,
|| <|| 菜单项1 || 菜单项2 || 菜单项3 || > ||
我想把它放在屏幕上方。 它可以有超过3个菜单项,它可以遍历上一个和下一个箭头。 我是这样开始的,
RelativeLayout(width - fill_parent)
图库视图(此处我附加了适配器)有两个问题, - 图库视图包含之前和之后的空间 - 滚动其项目时会被选中
虽然它不是理想的解决方案。 我该如何构建这样的自定义组件? 任何帮助赞赏。
谢谢
I am working on horizontal menu that will open on top of the screen. Layout is something like following,
|| < || Menu Item1 || Menu Item2 || Menu Item3 || > ||
I want to put this on top of the screen. It can have more than 3 menu item and it can traverse through previous and next arrow. I started with like this,
RelativeLayout ( width - fill_parent)
Gallery View ( Here i appended adapter )There is two problem, - Gallery view contains the space before and after - While scrolling its item gets selected
Though its not ideal solution for this. How can i build custom component like this ? Any help appreciated.
Thanks
最满意答案
如果你想使用一个图库,你可以覆盖onFling行为,如果你想说减慢投掷或忽略垂直投掷等。
要禁用该空间,有一个api调用gallery.setSpacing() ...要在您投掷时不选择使用gallery.setCallbackDuringFling(false)
但是,如果你想要的只是一个用左右按钮滚动的静态菜单,我只是将LinearLayout子类化并从那里开始。
If you want to use a gallery, you can override the onFling behaviour if you want to say slow down the fling or ignore vertical fling etc.
To disable the space, there is a an api call gallery.setSpacing()... To make the gallery not select when you are flinging use gallery.setCallbackDuringFling(false)
However, if all you want is a static menu that scrolls with the left and right buttons, I'd just subclass a LinearLayout and go from there.
更多推荐
菜单,item,screen,电脑培训,计算机培训,IT培训"/> <meta name="description&qu
发布评论