Skip to content

在Android上当调用showMenu后并且有选择内容时,菜单定位有问题 #52

Open

Description

@aa2013

以下均为示例程序中的代码
步骤:

  1. 设置toolbarController
    image

  2. 选择文本,并在ContextMenuControllerImpl中调用showMenu
    此时anchors.primaryAnchor的值为Offset(-10000.0, -10000.0),而anchors.secondaryAnchor此时不为null,为正确的值,样例程序中使用了anchors.primaryAnchor会导致菜单定位到屏幕左上角,如果不选择文本仅长按的话,primaryAnchor为(0,0), secondaryAnchor 为null
    image

  3. 在Android上调用showMenu后,编辑器中选择的文本没有框选背景了,感觉是被抢了焦点?现在我的解决办法是showMenu后延迟一段时间重新对selection进行赋值操作
    image

  4. 还有就是Android上长按不会自动选择点击所在的文本

Activity

  1. added
    bug
    on Nov 3, 2024
  2. MegatronKing commented on Nov 3, 2024

    @MegatronKing
    Member

    你好,位置不正确不知道是不是example的问题,我用reqable测试好像没有这个问题。最后一个问题,Android上长按不会自动选择点击所在的文本,这个问题能复现。

  3. qinshah commented on Oct 6, 2025

    @qinshah

    感觉确实有问题,如果是拖动选择内容,那么右键菜单就会跑到左上角,如果是双击自动选中的话位置有可能正确。并且选中部分的高亮色都会丢失。

    Image

  4. qinshah commented on Oct 6, 2025

    @qinshah

    又发现其实是看选完文本之后的光标位置是在选之前光标的下方还是上方:如果是下方,菜单就会跑到左上角;如果是上方就不会。长按选择和双击选择都是这样。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions