简体   繁体   English

使用按钮文本和按钮创建菜单/操作栏

[英]creating a menu/actionbar with buttons text and buttons

EDIT: I am looking for a ActionBar Menu, not nessicarily a menu that just sits on the bottom of the screen. 编辑:我正在寻找一个ActionBar菜单,而不是通常只位于屏幕底部的菜单。

I was looking at the menu XML object, I was building all of the menus and then will assign them accordingly with their click handles when the Activities load. 我正在查看菜单XML对象,正在构建所有菜单,然后在“活动”加载时为其分配相应的单击句柄。

My issue is this: When looking on the Android website, there was a way to do: 我的问题是:在Android网站上浏览时,有一种方法可以做到:

[         Title        ]
[ b1 ][ b2 ][ b3 ][ b4 ]

but i wanted to do something like: 但我想做这样的事情:

[ b1 ][ b2 ][ _Title_ ][ b3 ][ b4 ]

is it possible via adding items, or should i try a different approach, like populating a view with buttons and style the view so it acts like a menu? 是否可以通过添加项目来实现?还是我应该尝试其他方法,例如使用按钮填充视图并设置视图样式以使其像菜单一样?

You should look at ActionBarSherlock . 您应该看看ActionBarSherlock It has extensive support and helps give a more unified Android experience emulating many of the standard Google Apps on the phone. 它具有广泛的支持,并可以在手机上模拟许多标准的Google Apps,从而提供更加统一的Android体验。

Its very customizable allowing you to place the actionbar on the top or the bottom. 它非常可定制,可让您将操作栏放在顶部或底部。 Likewise it allows you to place all content contained in the actionbar wherever you please. 同样,它允许您将包含在操作栏中的所有内容放在任意位置。

loading a menu resolved the buttons. 加载菜单解决了按钮。 From inside of that list, you can tell certain things to always show. 从该列表的内部,您可以告诉某些事情总是显示。 If you do that, could could use one of the menu items to NOT have a click listener and use it to display. 如果这样做,可以使用菜单项之一不具有单击侦听器并使用它来显示。 As an alternate, you could use another program such as actionbarsherlock, but that was not the intent of the question. 或者,您可以使用其他程序,例如actionbarsherlock,但这不是问题的意图。 EVERYTHING can be solved with plugins, so it doesnt really "solve" the question, but abstracts it, in a way, deferring the solution to another source without really giving a proper how-to. 一切都可以通过插件解决,因此它并不能真正“解决”问题,而是可以通过某种方式将其抽象化,将解决方案推迟到另一个来源,而无需给出适当的操作方法。

With that said, I did move to a different layout. 话虽如此,我的确选择了其他布局。 Instead of me doing a title in the center, i actually, used a title in a slightly different location to maintain some nativity along with the design currently implemented in the iOS implementation of our application. 实际上,我不是在中间做标题,而是在稍微不同的位置使用了标题,以保持某种诞生感以及当前在应用程序的iOS实现中实现的设计。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM