如何创建 LWUIT 3D 轮播
有谁知道如何在 LWUIT 中创建 3d 轮播效果?谁能用一个示例程序向我解释如何实施?
Do anyone know on how to create 3d carousel effect in LWUIT?. Can anyone explain me with a sample program on how to implement?.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,我考虑你想使用列表,这是最明智的方法,不是吗?
您想要了解的第一件事是这个
List.setFixedSelection(List.FIXED_CENTER)
,这是最简单的部分。 Tha方法使列表围绕中间显示的元素滚动,也就是说,它会添加轮播效果。困难的部分出现在添加 3D 时。首先,您应该看看这个文章,如果您还没有这样做的话。必须了解 LWUIT 列表的工作原理以及可以用它们做什么(以及如何做)。基本上你需要实现一个
ListCellRenderer
特别是getListCellRendererComponent(List list, Object value, int index, boolean isSelected) ,您必须在其中添加相应的逻辑来检测列表元素将在何处绘制,并使用样式来放阴影、渐变或任何你想要的。很抱歉,我没有任何示例给您,也许您可以看看 Shai 的博客,我不知道是否有那个特定的样本,但是有很多。
祝你好运并致以问候。
First of all, I'm considering you want to use Lists, that's the most sensible way to do it, isn't is?
The first thing you want to know is this
List.setFixedSelection(List.FIXED_CENTER)
, and that's the easy part. Tha method makes the list scroll around the middle displayed element, it's to say, it will add the carousel effect.The difficult part comes when adding the 3D. First ad all, you should have a look to this article, if you haven't done it yet. It's compulsory to understand how LWUIT Lists work and what you can do (and how) with them. Basically you would need to implement a
ListCellRenderer
and specially thegetListCellRendererComponent(List list, Object value, int index, boolean isSelected)
, there you would have to add the corresponding logic to detect where the list element is going to be painted, and play with the Styles to set shadows, gradients, or whatever you want.And I'm sorry but I don't have any sample for you, maybe you can have a look at Shai's Blog, I don't know whether there is that specific sample, but there are a lot of them.
Good luck and regards.