简体   繁体   English

任何“谷歌键盘”悄悄话? API19

[英]Any “Google Keyboard” Whisperers out there? API19

I'm having what seems to be an odd problem, and I'd greatly appreciate any suggestions which might help. 我有一个看似奇怪的问题,我非常感谢任何可能有帮助的建议。

I'm trying to achieve due diligence by testing on a variety of screen form factors, but I'm having a problem when it comes to the default ( AKA Google ) keyboard on an emulated Nexus 4 using API level 19. AFAIK, according to the on-line specs the Nexus 4 was released with API 17, so it would seem to me that 19 ought to be able to handle any hardware in the Nexus 4. 我试图通过测试各种屏幕外形来实现尽职调查,但是我在使用API​​级别19的模拟Nexus 4上的默认(AKA Google)键盘时遇到了问题.AFAIK,根据在线规格Nexus 4与API 17一起发布,所以在我看来19应该能够处理Nexus 4中的任何硬件。

I'm working with an app that displays a document and if the User wishes, allows notes about the document to be entered, at the same time the document is being viewed. 我正在使用显示文档的应用程序,如果用户希望,则允许在查看文档的同时输入有关文档的注释。 By default most of the screen is taken by the view of the document. 默认情况下,大部分屏幕都是由文档视图拍摄的。 But when a Button is pressed to allow notes about the document to be entered, Views are re-arranged to allow for a soft keyboard to be displayed along with an EditText view to accept the notes and still allow for as much of the document to be viewed, as conveniently as possible, and scrolling is provided. 但是当按下按钮以允许输入关于文档的注释时,将重新排列视图以允许软键盘与EditText视图一起显示以接受注释,并且仍然允许尽可能多的文档尽可能方便地查看和滚动。

In the default "portrait" orientation I'm able to shoehorn in what I need with out too many problems; 在默认的“肖像”方向上,我能够在我需要的时候偷偷摸摸地解决太多问题; but oddly in "landscape" orientation, no matter how I try to constrain it, the on-screen keyboard itself occupies fully half the screen "height" and takes the other half with a separate input area it displays, several lines high; 但奇怪的是在“风景”方向,无论我如何限制它,屏幕键盘本身占据屏幕“高度”的一半,另一半显示一个单独的输入区域,几行高; the "DONE" button is displayed separately about half way up the height of the input area near the right screen edge. “DONE”按钮分别显示在靠近右侧屏幕边缘的输入区域高度的一半处。

In order to keep the soft keyboard and any associated input area as small/simple as possible, I've supplied these attributes for the EditText: 为了使软键盘和任何相关的输入区域尽可能小/简单,我为EditText提供了以下属性:

android:inputType="text|textNoSuggestions|textShortMessage"
android:singleLine="true"

and this for the themes in my styles.xml file : 这是我的styles.xml文件中的主题:

<item name="android:windowSoftInputMode">stateUnchanged</item>

I've even considered going as far as building a custom keyboard structure in XML, etc.. But my understanding is that Android won't allow a keyboard definition to be used "privately" for just one app; 我甚至考虑过用XML等构建自定义键盘结构。但我的理解是,Android不允许将键盘定义“私密地”用于一个应用程序; instead it requires a custom keyboard description to be approved by the User as the User's standard keyboard, or won't allow the custom keyboard to be used at all. 相反,它需要用户批准自定义键盘描述作为用户的标准键盘,或者根本不允许使用自定义键盘。

Have I've missed something? 我错过了什么吗? Am I not making the correct use of attributes for my purpose? 我没有为我的目的正确使用属性吗? Is there something else I need to do in order to get the desired effect? 为了获得理想的效果,我还需要做些什么吗? Does the actual Nexus 4 behave as I've described? 实际的Nexus 4是否像我描述的那样表现? Or is there a problem with the Emulation? 或者仿真有问题吗?

I'd be very grateful for any helpful thoughts. 我会非常感谢任何有用的想法。

Hopefully some images will help to illustrate the issue. 希望一些图像有助于说明问题。

Default document viewing mode: 默认文档查看模式: 默认文档查看模式的图像

After the User presses the "MAKE NOTES" Button, note taking mode. 用户按下“MAKE NOTES”按钮后,记下记录模式。 This is before the User presses within the EditText view ( which is displaying the hint string "To enter notes, press here" ) : 这是在用户按下EditText视图(显示提示字符串“要输入注释,按此处”)之前: 在EditText视图中按下之前记笔记的图像

When the "MAKE NOTES" button is pressed I rearrange things. 当按下“MAKE NOTES”按钮时,我重新安排了事情。 It appears to me that the controls fit roughly in the upper left quadrant, the document view is placed in the notably smaller scrollable area roughly in the upper right quadrant; 在我看来,控件大致适合左上象限,文档视图大致位于右上象限中明显较小的可滚动区域; I request that the keyboard be displayed, and it fits on the screen below those things. 我要求显示键盘,它适合在这些东西下方的屏幕上。 Since the keyboard does fit, I wouldn't have expected the "extract" view; 由于键盘确实适合,我不会期望“提取”视图; especially since by the time I got these emulator screen snapshots, I had restricted the EditText view to one text line, so I would expect input to occur in place, within the EditView, just as it does in "portrait" orientation... 特别是当我得到这些模拟器屏幕快照时,我将EditText视图限制为一个文本行,所以我希望输入在EditView中就位,就像在“纵向”方向一样...

Instead, when the User presses within the EditText view: 相反,当用户在EditText视图中按下时: 在EditText视图中按下之后的图像

There is no way to change the height of the keyboard. 无法改变键盘的高度。 The keyboard itself sets that, in the onComputeInsets of the InputMethodService class, combined with the height of the view returned in onCreateInputView. 键盘本身设置在InputMethodService类的onComputeInsets中,与onCreateInputView中返回的视图的高度相结合。

You actually can create a keyboard just for your app, but your users will hate you. 您实际上可以为您的应用创建一个键盘,但您的用户会讨厌您。 You aren't going to write Swype functionality, or good autocorrect, or anything else without spending the years on it the other companies have. 你不打算写其他公司没有花费多年的时间来写Swype功能,或者好的自动更正,或其他任何东西。

What you seem to be describing is a full-screen editing situation called extract view where the keyboard takes over the full screen in landscape mode. 您似乎要描述的是一种称为提取视图的全屏编辑情境,其中键盘以横向模式接管整个屏幕。 THat's the standard Android experience for phones because too little of the screen is left for apps to be usable. 这是手机的标准Android体验,因为屏幕太少,无法让应用程序使用。 Is that what you're seeing, or is it something else? 这就是你所看到的,还是别的什么? If it is extract mode, try adding android:imeOptions="flagNoExtractUi" to the textview . 如果是提取模式,请尝试将android:imeOptions="flagNoExtractUi"textview

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

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