【问题标题】:overriding the default android keyboard覆盖默认的android键盘
【发布时间】:2010-12-26 10:20:34
【问题描述】:

在我的应用程序中,当用户使用虚拟键盘编辑某个 MultiAutoCompleteTextView 时,我想向他展示默认的 android 键盘,但更改其上的两个按钮 - 不是它们的位置,而是它们上的图形(语音输入和笑脸按钮)及其功能。 有没有办法在不创建新的 InputMethod 或新的键盘类的情况下这样做?

【问题讨论】:

    标签: android keyboard virtual


    【解决方案1】:

    你当然可以创建一个自定义软键盘,但我认为你应该接受你所拥有的场景。为这么小的需求创建一个新的键盘输入确实会增加您的项目成本。

    查看用于 SoftKeyboard 的 SDK 示例,了解有关创建它的更多信息。您始终可以将操作键定义为笑脸按钮。

    这是一个直接来自android开源项目的代码示例:

    <EditText
       android:id="@+id/embedded_text_editor"
       android:layout_width="fill_parent"
       android:layout_height="wrap_content"
       android:autoText="true"
       android:capitalize="sentences"
       android:maxLines="4"
       android:inputType="textShortMessage|textAutoCorrect|textCapSentences|textMultiLine"
       android:imeOptions="actionSend|flagNoEnterAction"
       android:maxLength="1000"
    />
    

    注意android:inputType="textShortMessage",它正在发挥作用并创建一个笑脸按钮作为操作按钮。

    【讨论】:

      猜你喜欢
      • 2014-05-04
      • 1970-01-01
      • 1970-01-01
      • 2020-09-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多