类似 Twitter 示例的 Android 操作栏
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2900509/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Android action bar like twitter sample
提问by Baris
What is the best way to implement action bar like twitter sample UI Pattern.
实现类似 twitter 示例 UI 模式的操作栏的最佳方法是什么。
Twitter for Android: A closer look at Android's evolving UI patterns Pattern 4: Action Bar http://android-developers.blogspot.com/2010/05/twitter-for-android-closer-look-at.html
Android 版 Twitter:仔细观察 Android 不断发展的 UI 模式 模式 4:操作栏 http://android-developers.blogspot.com/2010/05/twitter-for-android-closer-look-at.html
采纳答案by Trevor Johns
You might want to take a look at the source code for the Google I/O 2010 schedule application, which is open source and contains an Action Bar implementation:
您可能需要查看 Google I/O 2010 日程安排应用程序的源代码,该应用程序是开源的并且包含一个操作栏实现:
回答by Johan Berg Nilsson
Yet another action bar implementation can be found here (shameless plug), https://github.com/johannilsson/android-actionbar. It's implemented as a library project so there's no need to copy-paste resources.
另一个操作栏实现可以在这里找到(无耻的插件),https://github.com/johannilsson/android-actionbar。它是作为一个库项目实现的,因此不需要复制粘贴资源。
Implementation wise it's built as a widget that extends a RelativeLayout with it own layout for the actions and the bar. This makes it possible to add it to layouts with it own xml snippet.
在实现方面,它被构建为一个小部件,它扩展了一个具有自己的操作和栏布局的 RelativeLayout。这使得可以使用它自己的 xml 片段将其添加到布局中。
<com.markupartist.android.widget.ActionBar
android:id="@+id/actionbar"
style="@style/ActionBar"
/>
And then later on refer to it in a activity to add actions.
然后稍后在活动中引用它以添加操作。
ActionBar actionBar = (ActionBar) findViewById(R.id.actionbar);
actionBar.setTitle("Other");
actionBar.setHomeAction(new IntentAction(this, HomeActivity.createIntent(this), R.drawable.ic_title_home_default));
actionBar.addAction(new IntentAction(this, createShareIntent(), R.drawable.ic_title_share_default));
actionBar.addAction(new ToastAction());
回答by Intrications
ActionBarSherlock at https://github.com/JakeWharton/ActionBarSherlockis an Android library for implementing the action bar design pattern using the native ActionBar on 3.0+ and a third-party library on pre-3.0.
https://github.com/JakeWharton/ActionBarSherlock上的ActionBarSherlock是一个 Android 库,用于使用 3.0+ 上的本机 ActionBar 和 3.0 之前的第三方库来实现操作栏设计模式。
回答by Juri
I'm also waiting hard till Google open sources the Twitter app...but also tweeting Reto Meier didn't bring info about a possible release...anyway.
我也在苦苦等待,直到谷歌开源 Twitter 应用程序......但也发推文 Reto Meier 没有带来有关可能发布的信息......无论如何。
Regarding QuickActions I found the following interesting links which may potentially be interesting for some of you here:
关于 QuickActions,我发现以下有趣的链接可能对你们中的一些人感兴趣:
- http://code.google.com/p/simple-quickactions/
- http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/
- http://code.google.com/p/simple-quickactions/
- http://www.londatiga.net/it/how-to-create-quickaction-dialog-in-android/
Have fun!
玩得开心!
回答by Alex Volovoy
Google suppose to open source twitter app pretty soon ( i hope ) as showcase for all they talk about in this article. If you can't wait - hide title bar. Create layout that looks like that. Include it in all your activities via tag .
Google 想很快就会开源 twitter 应用程序(我希望)作为他们在本文中谈论的所有内容的展示。如果您迫不及待 - 隐藏标题栏。创建看起来像这样的布局。通过标签将其包含在您的所有活动中。
回答by Rodja
There is an Action Bar implementation in Tomdroid, a GPL note taking App which can sync with Tomboy.
Tomdroid 中有一个 Action Bar 实现,这是一个 GPL 笔记应用程序,可以与 Tomboy 同步。
See https://code.launchpad.net/~tomdroid-maintainers/tomdroid/main
见https://code.launchpad.net/~tomdroid-maintainers/tomdroid/main
回答by Camsoft
Android 4.x (Ice Cream Sandwich) now includes a native Action Bar: http://developer.android.com/guide/topics/ui/actionbar.html
Android 4.x (Ice Cream Sandwich) 现在包含一个原生操作栏:http: //developer.android.com/guide/topics/ui/actionbar.html
Android 4.x Design Guidelines: http://developer.android.com/design/patterns/actionbar.html
Android 4.x 设计指南:http: //developer.android.com/design/patterns/actionbar.html