【问题标题】:Want EditText Keyboard with "Enter Key" and without Auto Prediction想要带有“输入键”且没有自动预测的 EditText 键盘
【发布时间】:2017-08-28 12:37:25
【问题描述】:

我已经尝试了所有组合,但仍然没有达到我想要的效果,所以请帮助我!

我想要什么

我需要 键盘 没有 auto predictionenter key 用于多用途

  1. 单击:应该转到下一行
  2. 长按:应该显示表情符号键盘 和

这里是代码

<EditText
        android:id="@+id/editTextWord"
        android:gravity="top|start"
        android:paddingStart="8dp"
        android:scrollbarStyle="insideInset"
        android:scrollbars="vertical"
        android:overScrollMode="always"
        android:background="@color/background_walk_through_six"
        android:paddingEnd="8dp"
        android:focusable="true"
        android:focusableInTouchMode="true"
        android:layout_above="@+id/txtCharacters"
        android:backgroundTint="@android:color/transparent"
        android:inputType="textMultiLine"
        android:layout_width="match_parent"
        android:layout_height="match_parent" />

我的尝试

  1. android:inputType="textMultiLine"

  1. android:inputType="textMultiLine|textNoSuggestions"

以上行显示enter key 已完成,但我无法阻止auto prediction

  1. android:inputType="textMultiLine|textNoSuggestions|textVisiblePassword"

上面的行显示enter keynextline[单击] 并防止auto prediction 意味着当我添加textVisiblePassword 表情符号时,长按Enter Key 时不显示

我已经尝试以编程方式但它显示 done 按钮

editTextWord.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS);

我想你现在明白我需要什么了!

【问题讨论】:

    标签: android android-edittext android-softkeyboard


    【解决方案1】:

    您可以像这样以编程方式执行此操作:

    editText.setImeOptions(EditorInfo.IME_ACTION_UNSPECIFIED);
    editText.setInputType(InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS |  InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD | InputType.TYPE_TEXT_FLAG_MULTI_LINE);
    

    由于 inputType 需要多个值,您可以将其添加到您的 xml 中,如下所述:How to add many values in android:tag

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-02-17
      • 2011-07-31
      • 2013-10-16
      • 1970-01-01
      • 2013-05-26
      • 1970-01-01
      • 2010-09-21
      • 2013-04-20
      相关资源
      最近更新 更多