按下物理后退按钮时,上下文操作栏(操作模式)总是被破坏

时间:2016-11-11 10:21:08

标签: android android-actionmode android-cab

所以,我不想在某些条件下关闭动作模式。所以试着做以下

 _ = Timer.scheduledTimer(timeInterval: time, target: self, selector: #selector(GameScene.method), userInfo: nil, repeats: false)

 func method() {
     //Do your task
     time += 0.95 //increase timer
     //Schedule it again
     _ = Timer.scheduledTimer(timeInterval: time, target: self, selector: #selector(GameScene.method), userInfo: nil, repeats: false)
 }

但每次按下按钮时它仍然会关闭CAB。 可能是什么原因?

1 个答案:

答案 0 :(得分:0)

在styles.xml文件中添加

<!--  It should be true otherwise action mode will not overlay toolbar -->
        <item name="windowActionModeOverlay">true</item>

        <!--  For Custom Action Mode Background Color/Drawable -->
        <item name="actionModeBackground">@color/colorAccent</item>