用户登录
用户注册

分享至

如何在横向模式下只打开半键盘?

  • 作者: 段友43745
  • 来源: 51数据库
  • 2023-02-09

问题描述

我想开发一款基于 Android 打字的游戏.我真的希望这款游戏能够在横向模式下运行,因为在我看来,它是更具体的 Android 游戏.

I want to develop an Android typing based game. I would really want this game to work on landscape mode, because, in my opinion, it is more specific Android games.

这是第一个问题

如果我切换横向模式,当用户打开键盘时,他看不到屏幕的其余部分,因为在横向模式下它会打开全屏.(我的键盘就是这样做的)

if I toggle landscape mode, when the user opens the keyboard he can not see the rest of the screen because in Landscape Mode it opens Full Screen. (my keyboard does this)

问题:有什么方法可以让我在横向模式下只打开半个键盘,这样用户就可以看到他在哪里打字,或者有没有人找到解决这个问题的其他方法?

Question: Is there any way in which I can open only half keyboard in Landscape Mode so that the user can see what where he is typing or does anyone find another way to solve this problem?

非常感谢!

推荐答案

添加这个:

android:imeOptions="flagNoExtractUi"

到您的 EditText 节点(在 xml 中)将使键盘在屏幕的一半上弹出,并允许您在文本字段中(在您的 UI 中)而不是在其自身(全屏)中编辑文本文本编辑区.

to your EditText node (in the xml) will make it so that the keyboard pops up on half the screen and lets you edit the text right IN the text field (in your UI) rather than in its own (full screen) text edit area.

我刚刚在 Galaxy Nexus(运行 ICS)和 RAZR Maxx(运行 Gingerbread)中对此进行了测试,该应用是为 midSdk 10 (2.3.3) 编译的.它似乎有效.

I've just tested this in a Galaxy Nexus (running ICS) and a RAZR Maxx (running Gingerbread), the app is compiled for midSdk 10 (2.3.3). It appears to work.

软件
前端设计
程序设计
Java相关