标签: android-softkeyboard

活动开始时如何隐藏软键盘

android:windowSoftInputMode="stateVisible"在Manifest中有一个Edittext .现在,当我开始活动时,将显示键盘.如何隐藏它?我无法使用,android:windowSoftInputMode="stateHidden因为当键盘可见时,最小化应用程序并恢复它键盘应该是可见的.我试过了

InputMethodManager imm = (InputMethodManager) getSystemService(INPUT_METHOD_SERVICE); imm.hideSoftInputFromWindow(getCurrentFocus().getWindowToken(), 0);

但它不起作用.

android android-softkeyboard

146
推荐指数
15
解决办法
20万
查看次数

Android屏幕键盘自动弹出

我的一个应用程序有一个"打开屏幕"(基本上是一个菜单),EditText后面跟着几个Buttons.问题是,我的一些用户报告说,当他们打开应用程序时,它会自动弹出屏幕键盘而不会触摸屏幕EditText.据我所知,所有这些用户都在使用HTC Hero.

这是1.5中的错误吗?我能做些什么吗?

android android-softkeyboard

137
推荐指数
5
解决办法
11万
查看次数

Android中的活动中的软键盘打开和关闭监听器

我有一个Activity有5 EditText秒的地方.当用户点击第一个时EditText,软键盘会打开以在其中输入一些值.我想设置一些其他ViewGone对软键盘打开时的可见性,以及用户点击第一个时的可见性,以及当按下后面按钮EditText时软键盘关闭时EditText.然后我想将其他View人的可见性设置为可见.

EditText在Android中第一次点击软键盘时,是否有任何监听器或回调或任何黑客攻击?

android android-softkeyboard android-edittext android-activity

123
推荐指数
11
解决办法
14万
查看次数

键盘上的Android使用完成按钮单击按钮

在我的应用程序中确定我有一个字段供用户输入数字.我将字段设置为仅接受数字.当用户点击该字段时,它会调出键盘.在键盘上(在ICS上)有一个完成按钮.我想让键盘上的完成按钮触发我在我的应用程序中的提交按钮.我的代码如下.

package com.michaelpeerman.probability;

import android.app.Activity;
import android.app.ProgressDialog;
import android.content.DialogInterface;
import android.content.DialogInterface.OnCancelListener;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import java.util.Random;

public class ProbabilityActivity extends Activity implements OnClickListener {

private Button submit;
ProgressDialog dialog;
int increment;
Thread background;
int heads = 0;
int tails = 0;

public void onCreate(Bundle paramBundle) {
    super.onCreate(paramBundle);
    setContentView(R.layout.main);
    submit = ((Button) findViewById(R.id.submit));
    submit.setOnClickListener(this);
}

public void onClick(View view) {
    increment = 1;
    dialog = new ProgressDialog(this);
    dialog.setCancelable(true); …
Run Code Online (Sandbox Code Playgroud)

android keyboard-events android-softkeyboard

116
推荐指数
5
解决办法
11万
查看次数

使用带有EditText的AlertDialog.Builder时,软键盘不会弹出

我使用AlertDialog.Builder来创建一个输入框,使用EditText作为输入方法.

遗憾的是,虽然EditText处于焦点状态,但软键盘不会弹出,除非您再次明确触摸它.

有没有办法强迫它弹出?

在(AlertDialog.Builder).show()之后尝试了以下内容.但无济于事.

InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.showSoftInput(input, InputMethodManager.SHOW_FORCED);
Run Code Online (Sandbox Code Playgroud)

有人可以帮忙吗?

谢谢!!

android android-softkeyboard android-input-method

115
推荐指数
8
解决办法
4万
查看次数

android中adjustResize和adjustPan的区别?

我尝试编写一个代码,用于在出现软键盘时重新调整UI组件的大小.当我使用adjustResize时,它重新调整UI组件的大小,同时adjustPan给了我相同的输出.我想知道它们之间的区别以及何时使用每个组件?哪一个(adjustPan或adjustResize)有助于调整UI的大小?

这是我的xml:

<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true" >

    <RelativeLayout
        android:layout_width="fill_parent"
        android:layout_height="wrap_content" >

        <LinearLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:orientation="vertical" >

            <EditText
                android:id="@+id/editText5"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginTop="45dp"
                android:ems="10"
                android:inputType="textPersonName" />

            <Button
                android:id="@+id/button1"
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:layout_marginBottom="40dp"
                android:text="My Button" />
        </LinearLayout>
    </RelativeLayout>

</ScrollView>
Run Code Online (Sandbox Code Playgroud)

和清单文件:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.example.adjustscroll"
    android:versionCode="1"
    android:versionName="1.0" >

    <uses-sdk
        android:minSdkVersion="8"
        android:targetSdkVersion="17" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <activity
            android:name="com.example.adjustscroll.MainActivity"
            android:label="@string/app_name"
            android:windowSoftInputMode="adjustPan|adjustResize" >
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
    </application>

</manifest>
Run Code Online (Sandbox Code Playgroud)

android android-softkeyboard

115
推荐指数
6
解决办法
13万
查看次数

以编程方式打开软键盘

我有一个没有子窗口小部件的活动,相应的xml文件是,

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/myLayout"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:focusable="true"
>
</LinearLayout>
Run Code Online (Sandbox Code Playgroud)

我想在活动开始时以编程方式打开软键盘.我现在尝试的是,

public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);
    InputMethodManager inputMethodManager = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
    if (inputMethodManager != null) {
        inputMethodManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0);
    }
Run Code Online (Sandbox Code Playgroud)

给我一些指导.

android android-softkeyboard

110
推荐指数
14
解决办法
12万
查看次数

How to remove auto focus/keyboard popup of a field when the screen shows up?

我有一个屏幕,其中第一个字段是EditText,它在启动时获得焦点,也弹出数字输入类型,这是非常烦人的

如何确保在活动开始时没有获得焦点,和/或输入面板没有被提升?

keyboard android popup android-softkeyboard

101
推荐指数
6
解决办法
7万
查看次数

在软键盘上使用"ENTER"键而不是单击按钮

您好我有搜索EditText和搜索Button.当我输入搜索到的文本时,我想在软键盘上使用ENTER键而不是搜索Button来激活搜索功能.

提前感谢您的帮助.

keyboard android android-softkeyboard

89
推荐指数
4
解决办法
12万
查看次数

如何在软键盘显示android时移动布局

EditTexts我的布局中有一个带有两个登录屏幕和一个登录按钮的登录屏幕.问题是,当我开始输入时,会显示软键盘并覆盖登录按钮.如何在键盘出现时向上或向上推动布局?

我不想使用a ScrollView,只想在不向下滚动的情况下实现它.拜托,建议我做一些方法.提前致谢.

android android-softkeyboard

84
推荐指数
8
解决办法
12万
查看次数