ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

android – 从用户的角度来看,禁用横向软键盘输入的全屏编辑视图?

2019-05-29 19:11:21  阅读:219  来源: 互联网

标签:android android-softkeyboard android-input-method


我正在寻找this exact question的答案,但是从用户的角度来看.也就是说,如果平板电脑显示正常的应用程序UI,即使键盘在横向模式下可见,是什么导致手机不这样做?我讨厌这个“全屏”编辑框,而且更愿意看到该应用程序的正常用户界面的剩余一半(尽管可能会有更少的可见;对于今天的巨大手机,仍然有“充足”的屏幕空间可用).

例如,是否有一个配置文件,其中一个可能调整一个设置(即让设备相信它的屏幕更大,或类似的效果)?我完全意识到这可能需要root,我对此很好.要清楚,我知道改变所有“冒犯”的应用程序既不可行也不可取.

我意识到这并不是一个严格意义上的编程问题,但是将短语组合在一起会非常困难,甚至可以得到一些合理的搜索结果.为了记录,我使用的是Nexus 4,但问题基本上与设备和版本无关.

解决方法:

根据docs

IME_FLAG_NO_EXTRACT_UI: For input methods that may be fullscreen, often when in landscape mode, this allows them to be smaller and let part of the application be shown behind. Though there will likely be limited access to the application available from the user, it can make the experience of a (mostly) fullscreen IME less jarring. Note that when this flag is specified the IME may not be set up to be able to display text, so it should only be used in situations where this is not needed.

因为手机具有较小的屏幕空间,所以可能使用户更难以看到整个UI并且能够正确地操作它,尤其是如果你有一些“较高”的UI元素可能不适合横向模式的屏幕.

更新:从操作系统级别的角度来看,解决方案位于(至少在ICS中)android / inputmethodservice / InputMethodService.java:2107:

/**
 * Called when the fullscreen-mode extracting editor info has changed,
 * to determine whether the extracting (extract text and candidates) portion
 * of the UI should be shown.  The standard implementation hides or shows
 * the extract area depending on whether it makes sense for the
 * current editor.  In particular, a {@link InputType#TYPE_NULL}
 * input type or {@link EditorInfo#IME_FLAG_NO_EXTRACT_UI} flag will
 * turn off the extract area since there is no text to be shown.
 */
public void onUpdateExtractingVisibility(EditorInfo ei) {
    if (ei.inputType == InputType.TYPE_NULL ||
            (ei.imeOptions&EditorInfo.IME_FLAG_NO_EXTRACT_UI) != 0) {
        // No reason to show extract UI!
        setExtractViewShown(false);
        return;
    }

    setExtractViewShown(true);
}

要删除此功能,您必须覆盖onUpdateExtractingVisibility(EditorInfo)并在不调用super的情况下调用setExtractViewShown(false).

标签:android,android-softkeyboard,android-input-method
来源: https://codeday.me/bug/20190529/1180140.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有