具有补间动画的水平滚动菜单栏
我想构建一个由按钮和菜单栏组成的自定义 UI 组件。
单击按钮时,按钮将补间远离屏幕,然后菜单栏将补间。菜单栏由一组可水平滚动的图标组成。这样的例子就像福克斯新闻应用程序,您可以从滚动条中选择所需的新闻类型。如此处所示。
另一个例子是在Thinking Space应用程序上,当用户单击菜单按钮时,绘图工具栏就会出现。我需要在这个应用程序上准确显示。
我已经阅读了一些关于从 android 页面构建自定义 UI 组件的指南,但还没有找到应该从哪里开始的线索。我是否需要通过扩展 View 类来完全从头开始构建?如果是这样,我如何实现补间动画,我不知道应该在 onDraw() 方法中绘制哪个,因为栏和按钮不会同时出现在屏幕上。
有什么建议或例子可以引导我走向光明吗?这是我第一次构建自定义 UI 组件。
如果需要的话,我会为您提供更多信息来帮助我。
非常感谢!
I wanted to build a custom UI component which consist of a button and a menu bar.
When the button is clicked, the button will tween away from the screen, then the menu bar will tween in. The menu bar is built a set of icons scrollable horizontally. Such example is like the Fox News app where you select the type news you want from the scroll bar. Such as shown here.
Another example is on the app Thinking Space, when user click on the menu button and the drawing toolbar comes up. I need exactly shown on this app.
I've read several guides on building a custom UI component from android's page but have not yet got a clue on where should I start. Do I need to completely build from scratch by extending View class? If it's so, how do I implement the tweening animation, I do not know which should be drawn in onDraw() method as the bar and the button will not both appear on the screen.
Any advice or example to guide me to the light? It's my first time building custom UI components.
I'll provide more information for you to help me, if needed.
Thank you very much!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您是否考虑过使用 Tabhost ,并在每个 Tabspec 中使用包含您的菜单的 HorizontalScrollView
?这就是你想要的吗?
在你的 LAyout xml 中:
这对我有用,
它看起来像这样:
did you think about using Tabhost , and in each Tabspec , use an HorizontalScrollView which will contains your menu
?? is that what you want ?
in your LAyout xml :
that's work for me ,
it looks like this :