Android的兼容性上下文操作栏 [英] Android compatibility contextual action bar

查看:213
本文介绍了Android的兼容性上下文操作栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在试图按照Android的设计指南,我遇到了一个小窘境。

In trying to follow the Android Design Guidelines, I'm running into a small quandary.

我想有,我可以长期preSS几个(多选)的项目清单,然后再对它们进行批量操作。

I want to have a list of items that I can long-press several of (multi-select), and then perform bulk actions on them.

的设计指南建议使用上下文操作栏这一点,这听起来非常像我的初衷。问题是,我试图保持兼容性向后API 7(因为我的手机是2.3.3目前)。

The Design Guidelines suggest using the Contextual Action Bar for this, and it sounds perfectly like what I had in mind. Problem is, I'm trying to maintain compatibility backwards to API 7 (due to my phone being 2.3.3 currently).

ActionBarSherlock 让其他动作条的东西,但我似乎无法弄清楚如何得到它要么启动一个上下文行动起来吧,我也没有想出如何我使用在ABS任意添加按钮的动作条。我看你可以做的标签,所以也许这就是答案,但因为我试图让多选,我不希望有正常模式的上下文菜单。

I'm using ActionBarSherlock to get other actionbar stuff, but I can't seem to figure out how to get it to either fire up a contextual action bar, nor have I figured out how to add buttons arbitrarily to the ActionBar in ABS. I see you can do tabs, so maybe that's the answer, but since I'm trying to allow multi-select, I don't want to have the normal modal context menu.

推荐答案

设置上下文动作条是一样的,以建立常规动作条项目尽可能的XML关注。 此例中的开发人员指南解释这一切

Setting up contextual actionbar is the same to setting up the 'regular' ActionBar items as far as the XML is concerned. This example in the developer's guide explains it all.

为了使用ActionBarSherlock,取代默认的Andr​​oid,回调到ActionBarSherlock编辑的回调(例如,而不是 Android.View.ActionMode 中,使用 com.actionbarsherlock.view.ActionMode )。

In order to use ActionBarSherlock, replace the default Android-callbacks to the ActionBarSherlock-edited callbacks (e.g. instead of Android.View.ActionMode, use com.actionbarsherlock.view.ActionMode).

这篇关于Android的兼容性上下文操作栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆