显示ActionMode在工具栏 [英] Display ActionMode over Toolbar

查看:313
本文介绍了显示ActionMode在工具栏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图使用 android.view.ActionMode android.support.v7.widget.Toolbar ,除了传统的 android.app.ActionBar 。我能够与显示它:

  toolbar.startActionMode(回调);
 

的问题是, ActionMode 显示在动作条,而不是在工具栏。有没有办法来改变这种状况?

我tryied设置在我的主题下,但它似乎并没有改变什么:

 <项目名称=windowActionModeOverlay>真< /项目>
 

解决方案
  

由于您使用的是工具栏,我还以为你正在使用    AppCompatActivity 键,取代了内置的动作条与   您的自定义工具栏使用 setSupportActionBar(工具栏);

首先确保您输入正确的名称空间。

 进口android.support.v7.view.ActionMode;
 

和不

 进口android.view.ActionMode;
 

然后用

  _actionMode = startSupportActionMode(本);
 

和不

  _actionMode = startActionMode(本);
 

I am trying to use the android.view.ActionMode with the new android.support.v7.widget.Toolbar, in addition to the traditional android.app.ActionBar. I am able to display it with:

toolbar.startActionMode(callback);

The problem is that the ActionMode is displayed over the ActionBar, and not over the Toolbar. Is there a way to change that?

I tryied to set the following in my theme, but it does not seem to change anything:

<item name="windowActionModeOverlay">true</item>

解决方案

Since you are using the Toolbar, I also assume you are using the AppCompatActivity and have replaced the built in ActionBar with your custom Toolbar using setSupportActionBar(toolbar);

First of all ensure you are importing the correct namespace.

import android.support.v7.view.ActionMode;

and NOT

import android.view.ActionMode;

then use

_actionMode = startSupportActionMode(this);

and NOT

_actionMode = startActionMode(this);

这篇关于显示ActionMode在工具栏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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