实现 Twitter 示例 UI 模式等操作栏的最佳方法是什么?
Android 版 Twitter:深入了解 Android 不断演变的 UI 模式
模式4:操作栏http://android-developers.blogspot.com/2010/05/twitter-for-android-closer-look-at.html http://android-developers.blogspot.com/2010/05/twitter-for-android-closer-look-at.html
可以在这里找到另一个操作栏实现(无耻插件),https://github.com/johannilsson/android-actionbar https://github.com/johannilsson/android-actionbar。它作为一个库项目实现,因此无需复制粘贴资源。
在实现方面,它被构建为一个小部件,它使用自己的操作和栏布局扩展了RelativeLayout。这使得可以使用自己的 xml 片段将其添加到布局中。
<com.markupartist.android.widget.ActionBar
android:id="@+id/actionbar"
style="@style/ActionBar"
/>
然后稍后在活动中引用它来添加操作。
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());
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)