我的布局中有一个EditText
和一个Button
.
在编辑字段中写入并单击后Button
,我想隐藏虚拟键盘.我假设这是一段简单的代码,但我在哪里可以找到它的一个例子?
android soft-keyboard android-layout android-softkeyboard android-input-method
我有一个在TabHost中运行的Activity(扩展Activity).我从用户操作启动Android电子邮件客户端.如果我点击电子邮件客户端中的"放弃"按钮,电子邮件客户端将退出,但屏幕上的键盘仍然可见.
我的应用程序上没有EditTexts,因此不确定为什么键盘会保持运行状态.我已经尝试了几次迭代,如何在完成活动后移除键盘?但是没有运气.有什么想法吗?
代码示例
package com.test.launchmail;
import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.util.Log;
import android.view.inputmethod.InputMethodManager;
import android.widget.Toast;
public class myEmail extends Activity
{
private final String TAG = "** Email **";
public static void send (Context ctx, String addy, String subject, String body)
{
// check to make sure the entry has a phone number
try
{
// use the builtin chooser for users mail app
Intent sendIntent = new Intent(Intent.ACTION_SEND);
sendIntent.setType("text/plain");
sendIntent.putExtra(android.content.Intent.EXTRA_EMAIL, new String [] {addy});
sendIntent.putExtra(android.content.Intent.EXTRA_SUBJECT, …
Run Code Online (Sandbox Code Playgroud) android ×2