简体   繁体   English

Android屏幕键盘,没有任何其他键盘

[英]Android onscreen keyboard without any other keyboard

I've looked at several questions and come across several posts, but i'm not able to figure out how to do this. 我已经看过几个问题并遇到了几篇文章,但是我不知道该怎么做。

The following picture shows you the basic layout : 下图显示了基本布局: 在此处输入图片说明

I've created a custom numpad and put it up on the repo. 我创建了一个自定义的数字键盘并将其放在仓库中。

Currently, when the app opens, the edit text has the focus but and anything i enter with the keyboard will go into the edittext box. 当前,当应用程序打开时,编辑文本将成为焦点,但是我用键盘输入的所有内容都将进入edittext框。 This part of the functionality works fine. 该功能的这一部分工作正常。

Problem : When i touch the edittext again, system Input Method with its huge keyboard pops up. 问题 :当我再次触摸edittext时,会弹出带有巨大键盘的系统输入法。 How do i completely block it from popping up? 我如何完全阻止它弹出? Or, can i tell the app to use only my keyboard instead of the system one? 或者,我可以告诉该应用程序仅使用我的键盘而不使用系统键盘吗? (Or is the only way to write a custom ime?) (或者是编写自定义ime的唯一方法?)

i cannot use NULL type input at the manifest because doing that makes the caret in the edittext disappear and moreover if there are two edit texts, i wouldnt know which has focus. 我无法在清单上使用NULL类型输入,因为这样做会使edittext中的插入符号消失,而且如果有两个编辑文本,我将不知道哪个具有焦点。

Any help would be highly appreciated! 任何帮助将不胜感激!

You can do a few things: 您可以做一些事情:

  1. Programmatically hide it in the whole app: 以编程方式将其隐藏在整个应用程序中:

     getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN); 
  2. Hide it from the view it would be attached to: 从将其附加到的视图中隐藏它:

     InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(yourEditText.getWindowToken(), 0); 
  3. Set the input type of the EditText to 0: 将EditText的输入类型设置为0:

     EditText yourEditText=(EditText)findViewById(R.id.editTextConvertValue); yourEditText.setInputType(0); 

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

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