简体   繁体   English

当我在Android中选择文本时弹出的“替换”对象是什么?

[英]What is the “Replace” object that pops up when I select text in Android?

I can't find a screenshot anywhere - but essentially, when I select text from an EditText on Android (4.0+, I think), a small white bubble saying REPLACE pops up, to allow me to replace the text with other predictions. 我在任何地方都找不到屏幕截图-但从本质EditText ,当我从Android(4.0+,我认为)的EditText选择文本时,会弹出一个白色小气泡,显示REPLACE ,以便我可以用其他预测替换文本。 The same kind of bubble pops up saying PASTE when I long press a field. 长按一个字段时,会弹出同样的气泡,说“ PASTE What class is this? 这是什么班? I can't seem to find any reference to it in the developer docs; 我似乎在开发人员文档中找不到对此的任何引用; could somebody help me out? 有人可以帮我吗?

If it's just a custom view, where is it instantiated? 如果只是自定义视图,则在哪里实例化? I'd like to write an Xposed module that requires this method, but I'm damned if I can find it. 我想编写一个需要此方法的Xposed模块,但是如果我能找到它,那该死的。

Thanks! 谢谢!

You want to get rid of this one? 您要摆脱这个吗?

带有粘贴菜单的文本选择手柄

The PASTE/REPLACE menu code is in the show() method of the (non-documented) android.widget.Editor class: PASTE / REPLACE菜单代码位于(未记录) android.widget.Editor类的show()方法中:

    public void show() {
        boolean canPaste = mTextView.canPaste();
        boolean canSuggest = mTextView.isSuggestionsEnabled() && isCursorInsideSuggestionSpan();
        mPasteTextView.setVisibility(canPaste ? View.VISIBLE : View.GONE);
        mReplaceTextView.setVisibility(canSuggest ? View.VISIBLE : View.GONE);

        if (!canPaste && !canSuggest) return;

        super.show();
    }

Related: https://stackoverflow.com/a/28893714/3063884 相关: https : //stackoverflow.com/a/28893714/3063884

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM