gpt4 book ai didi

android - 在工具栏上显示 ActionMode

转载 作者:IT老高 更新时间:2023-10-28 13:08:53 29 4
gpt4 key购买 nike

除了传统的 android 之外,我正在尝试将 android.view.ActionMode 与新的 android.support.v7.widget.Toolbar 一起使用.app.ActionBar。我可以通过以下方式显示它:

toolbar.startActionMode(callback);

问题是 ActionMode 显示在 ActionBar 上方,而不是 Toolbar 上方。有办法改变吗?

我尝试在主题中设置以下内容,但似乎没有任何改变:

<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);

首先确保您正在导入正确的命名空间:

import androidx.appcompat.view.ActionMode;
// Or
import android.support.v7.view.ActionMode;

不是

import android.view.ActionMode;

然后使用

_actionMode = startSupportActionMode(this);

不是

_actionMode = startActionMode(this);

关于android - 在工具栏上显示 ActionMode,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26483778/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com