我想从我的应用程序中选择一个选项来切换主菜单的显示.
功能仍然可以通过工具栏等使用,因此隐藏菜单不会带走任何东西.隐藏菜单实际上是用户的GUI选择.
无论如何,我的主菜单是使用TActionMenuBar和TActionManager设置的(对于XP alphablend样式).
我尝试简单地设置MainMenuBar的Visible属性,导致出现此错误消息:"ActionMainMenuBar不允许隐藏."
我认为这有点奇怪,因为Visible属性存在.如果我不能真正改变它,它为什么会存在呢?
像往常一样,我预计这是一个改变一个设置和瞧的简单案例,但不,我认为这可能需要更多的工作,我甚至不知道从哪里开始或寻找什么.
感谢您的想法和建议.
我正在使用Espresso进行测试,首先打开操作栏:
openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());
Run Code Online (Sandbox Code Playgroud)
一切都还可以,但是我想点击一个选项菜单:
onView(withId(R.id.action_menu)).perform(click());
Run Code Online (Sandbox Code Playgroud)
菜单布局xml有一个id为"action_menu"的选项.
我收到一个错误:
android.support.test.espresso.NoMatchingViewException: No views in hierarchy found matching: with id: ***.********.******.android.debug:id/action_menu
If the target view is not part of the view hierarchy, you may need to use Espresso.onData to load it from one of the following AdapterViews:android.support.v7.widget.ListPopupWindow$DropDownListView{43fd3f58 VFED.VC. .F...... 24,24-612,168}
Run Code Online (Sandbox Code Playgroud)
我通过使用以下方式实现了这一步:
onView(withText(R.string.action_report)).perform(click());
Run Code Online (Sandbox Code Playgroud)
我想知道id有什么问题.
有任何想法吗?
我想多选上下文菜单添加到listview与支持库22.1.1使用AppCompatActivity和Toolbar
没有支持库我可以使用 AbsListView.MultiChoiceModeListener
使用支持库,作为参数MultiChoiceModeListener接受的支持版本没有等效存在android.support.v7.view.ActionMode.
我该怎么做才能让它与支持库一起工作?
android android-appcompat android-listview action-menu android-contextmenu
德尔福Xe4.表单,ActionManager,ImageList(带有32x32图标),ActionMainMenuBar.
我无法确保图标显示正确.你该怎么办?

同时,如果我应用任何vcl风格的装饰,它显示正常.但是,如果默认情况下为"Windows"样式,则文本会移出图标.救命.



对不起英语不好.
我正在尝试使用动作模式获取上下文菜单,我可以通过长按它来选择ListView中的项目.我根据此引用创建了一个MultiChoiceListener,并创建了一个ItemLongClickListener,它将一个项设置为已选中,这是操作模式根据此引用工作所需的.
我的问题是,即使项目长时间点击动画正在播放,ActionMenu也不会膨胀.
ListView代码:
final ListView listView = (ListView) findViewById(android.R.id.list);
listView.setAdapter(adapter);
listView.setLongClickable(true);
listView.setChoiceMode(ListView.CHOICE_MODE_SINGLE);
listView.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long id) {
Cursor cursor = db.getSubject(id);
String subject = null;
try {
subject = cursor.getString(cursor.getColumnIndex("subject"));
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Intent intent = new Intent(Main.this, Marks.class);
intent.putExtra("selected", subject);
startActivity(intent);
}
});
listView.setOnItemLongClickListener(new OnItemLongClickListener() {
@Override
public boolean onItemLongClick(AdapterView<?> arg0, View arg1,
int arg2, long …Run Code Online (Sandbox Code Playgroud)