标签: android-softkeyboard

如何在本机活动上显示软键盘

当我尝试使用时ANativeActivity_showSoftInput(),它不会调出软键盘.

我尝试过使用ANativeActivity_showSoftInput(engine->app->activity, ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED)ANativeActivity_showSoftInput(engine->app->activity, ANATIVEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT)显示softinput,但也失败了.

我阅读了源代码,我发现启动nativeActivityNativeContentView(extend View)会创建,当调用时ANativeActivity_showSoftInput,它会showSoftInput()在java端调用.我想也许软键盘没有打开.

你能帮助我吗?

java android android-softkeyboard

11
推荐指数
1
解决办法
3108
查看次数

Android禁用软键盘中的Enter键

谁能告诉我如何禁用和启用Enter软键盘中的键?

android enter key android-softkeyboard

11
推荐指数
2
解决办法
1万
查看次数

需要数量只有软键盘?

嗨,我需要一个软键盘只用数值09Enter关键.不应该显示除了这些之外的任何东西. , ( )......

在此输入图像描述

我尝试了这里建议的几个选项,但没有什么似乎对我有用.

  1. setRawInputType(Configuration.KEYBOARD_QWERTY)
  2. setRawInputType(InputType.TYPE_CLASS_NUMBER | InputType.TYPE_NUMBER_FLAG_SIGNED)
  3. setRawInputType(InputType.TYPE_CLASS_NUMBER)
  4. setRawInputType(InputType.TYPE_CLASS_PHONE)

我总是在键盘上显示额外的字符,如:

在此输入图像描述

setRawInputType(Configuration.KEYBOARD_12KEY) 显示这样的键盘:

在此输入图像描述

非常感谢任何帮助.提前致谢.

注意:

  • android:minSdkVersion="14":ICS4.0
  • android:targetSdkVersion="17":JB 4.2

qwerty android ime android-softkeyboard android-input-method

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

向上滚动到软键盘

我有一个很长的形式,当软键盘出现时,我看不到底部的editTexts

这是我的xml

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

<RelativeLayout
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:paddingBottom="@dimen/activity_vertical_margin"
    android:paddingLeft="@dimen/activity_horizontal_margin"
    android:paddingRight="@dimen/activity_horizontal_margin"
    android:paddingTop="@dimen/activity_vertical_margin" >

    <TextView
        android:id="@+id/register_title"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="20dp"
        android:text="@string/register"
        android:textAppearance="?android:attr/textAppearanceLarge" />

    <TextView
        android:id="@+id/register_username"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/register_title"
        android:layout_centerHorizontal="true"
        android:text="@string/username" />

    <EditText
        android:id="@+id/register_edit_username"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/register_username"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="20dp"
        android:ems="10"
        android:inputType="text" >
    </EditText>

    <TextView
        android:id="@+id/register_password"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/register_edit_username"
        android:layout_centerHorizontal="true"
        android:text="@string/password" />

    <EditText
        android:id="@+id/register_edit_password"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/register_password"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="20dp"
        android:ems="10"
        android:inputType="textPassword" >
    </EditText>

    <TextView
        android:id="@+id/register_confirm"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/register_edit_password"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="20dp"
        android:text="@string/confirm" />

    <EditText
        android:id="@+id/register_edit_confirm"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_below="@+id/register_confirm"
        android:layout_centerHorizontal="true"
        android:layout_marginBottom="20dp"
        android:ems="10" …
Run Code Online (Sandbox Code Playgroud)

android android-softkeyboard

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

Android Done按钮代替Next

我的键盘有问题.我有一个ListView编辑文本,当键盘第一次打开时,显示完成按钮而不是下一步.问题是我需要adjustResizeAndroidManifest.xml中使用,当键盘显示时列表向上移动,所以我认为这就是键盘无法正常工作的原因.但我不知道如何解决这个问题.如果有人能帮助我,我将非常感激.

谢谢

android android-softkeyboard android-listview

11
推荐指数
2
解决办法
6632
查看次数

Android慢软键盘开启

我有一个非常讨厌的问题.在Android中制作注册表单,当EditText获得焦点时,键盘出现.但它真的很慢.即使在高端设备上也需要5秒或更长时间.

我们的应用程序使用多个层次的碎片.所以我想可能计算所有这些层向上滑动(当键盘出现时)需要这么长时间.当我在清单文件中设置"adjustNothing"时,键盘会快速显示,而在另一个我们只有一层片段的活动中(这一层是注册表单),它也会很快出现.

有人有类似的问题或建议吗?(隐藏或删除注册下方的片段不是一种选择)

keyboard android soft-keyboard android-softkeyboard android-fragments

11
推荐指数
1
解决办法
3474
查看次数

BottomSheetDialogFragment中ADJUST_RESIZE的不同行为

我正在尝试使用TextInputLayout创建一个BottomSheetDialogFragment.我将此BottomSheet设置为adjustResize以防止键盘覆盖TextInputLayout.问题是,我正在使用不同的Android版本获得不同的行为.

这是布局:

<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/linearLayout"
android:layout_width="match_parent"
android:layout_height="match_parent">

<android.support.design.widget.TextInputLayout
    android:id="@+id/textInputLayout"
    android:layout_width="0dp"
    android:layout_height="wrap_content"
    android:layout_marginBottom="16dp"
    android:layout_marginEnd="16dp"
    android:layout_marginStart="16dp"
    android:layout_marginTop="16dp"
    android:background="@android:color/darker_gray"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:layout_constraintVertical_bias="0.0">

    <android.support.design.widget.TextInputEditText
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:hint="hint" />
</android.support.design.widget.TextInputLayout>
Run Code Online (Sandbox Code Playgroud)

这是BottomSheetDialogFragment:

public class TestFragment extends BottomSheetDialogFragment {

@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {

    getDialog().getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);

    return inflater.inflate(R.layout.fragment_test, container, true);
}
Run Code Online (Sandbox Code Playgroud)

}

这是期望的结果:

在此输入图像描述

这是我在某些版本中得到的结果:

在此输入图像描述

我得到了预期的结果:

  • 搭载Android 7.0的Galaxy S6
  • 模拟器<= Android 5.1

没有预期的结果:

  • Nexus 5搭载Android 7.1.2(LineageOS 14.1)
  • 模拟器=> Android 6.0

有谁知道为什么会发生这种情况或如何解决它?

提前致谢!!!

干杯.

android android-layout android-softkeyboard bottom-sheet

11
推荐指数
1
解决办法
340
查看次数

如何在Android上创建多个IME(输入法编辑器)子类型?

我正在尝试创建多个IME子类型,但Android只能识别一个.

method.xml

<?xml version="1.0" encoding="utf-8"?>
<input-method
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:supportsSwitchingToNextInputMethod="true"
    android:settingsActivity="com.example.softkeyboard.Settings">


    <subtype android:name="@string/display_name_english_keyboard_dynamic_ime"
        android:imeSubtypeLocale="en_US"
        android:imeSubtypeMode="keyboard"
        android:imeSubtypeExtraValue="charDataFile=strokemaps_dynamic" />

    <subtype android:name="@string/display_name_english_keyboard_ime"
        android:imeSubtypeLocale="en_US"
        android:imeSubtypeMode="keyboard"
        android:imeSubtypeExtraValue="charDataFile=strokemaps" />

</input-method>
Run Code Online (Sandbox Code Playgroud)

strings.xml中的每个名称都有值.

<resources>
<string name="app_name">KK1</string>
<string name="display_name_english_keyboard_ime">English</string>
<string name="display_name_english_keyboard_dynamic_ime">English Dynamic</string>
Run Code Online (Sandbox Code Playgroud)

我的InputMethodService.onStartInputView方法包括:

@Override
public void onStartInputView(EditorInfo ei, boolean restarting) {

    super.onStartInputView(ei, restarting);

    InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE);
    List<InputMethodInfo> imil = imm.getEnabledInputMethodList();
    for (InputMethodInfo imi: imil) {
        Log.e("osiv", "input method info: "+imi.toString());
    }

    List<InputMethodSubtype> imsl = imm.getEnabledInputMethodSubtypeList(imil.get(0), true);

    for (InputMethodSubtype ims: imsl) {
        Log.e("osiv", "input method subtype: "+ims.toString());
    }
Run Code Online (Sandbox Code Playgroud)

列出的InputMethodInfos包含我的IME,但子类型列表只包含一个子类型.如果它是文件中唯一的子类型,则每个子类型都起作用.

Android 8.0设备不会在其语言/键盘配置选项中显示子类型,只显示IME本身,因此无法单独启用或禁用子类型. …

keyboard android ime android-softkeyboard android-8.0-oreo

11
推荐指数
1
解决办法
594
查看次数

显示没有动画的键盘

自从ICS以来我对软键盘的动画有问题.我使用软键盘进行数据输入活动.窗口设置为"adjustResize",以使所有视图适合软键盘上方的屏幕.由于Android 4是打开键盘的奇特动画,让我的屏幕上的视图"反弹".

看起来,好像视图是布局的,然后键盘打开,在此之后屏幕被转发,导致一种跳跃的用户体验.

有一个类似的问题:( 如何在Java中显示/隐藏软键盘而没有任何动画(例如淡入淡出)?)但是,那里的解决方案对我不起作用.(在4.2.1上测试)

我很高兴,如果有人有一些线索来实现以下解决方案之一:

  • 禁用活动的软键盘动画
  • 检索软键盘的大小以手动设置屏幕的大小

干杯,弗洛里安

android android-softkeyboard

10
推荐指数
1
解决办法
5784
查看次数

显示用于inputmethod的内置表情符号键

我正在为Android构建一个自定义软键盘,并希望添加一个布局,以包括类似于默认Android键盘(AOSP)正在做的表情符号键.我一直在搜索,但似乎大多数人都试图从图像中显示自定义表情符号.我想展示Android附带的内置图标(如下所示):

Android内置表情符号

似乎我应该能够使用Unicode字符从键盘发送图像,但我的第一次尝试似乎只生成了emojis的旧版本.我如何支持手机可以处理的最新表情符号?另外,如何在键盘上显示表情符号,如上图所示?

android emoticons android-softkeyboard emoji android-input-method

10
推荐指数
2
解决办法
1694
查看次数