【发布时间】:2013-10-11 03:10:44
【问题描述】:
如何更改 Android 默认键盘上任意键的标签。
我想做这样的事情,
【问题讨论】:
-
不可能,除非您要创建自己的键盘。
如何更改 Android 默认键盘上任意键的标签。
我想做这样的事情,
【问题讨论】:
您可以通过使用 KeyboardView 来实现这一点:
KeyboardView kbd = new KeyboardView(context);
kbd.setKeyboard(new Keyboard(this, R.xml.customlayout));
kbd.setOnKeyboardActionListener(new OnKeyboardActionListener() {
....
}
现在你有 kd 这是一个正常的视图。
这样做的好处是 R.xml.custom 引用 /res/xml/custom.xml,它在 xml 中定义了键盘的布局。有关此文件的更多信息,请查看此处:Keyboard、Keyboard.Row、Keyboard.Key。
【讨论】:
您可以使用自己的键盘来更改键盘的文本和样式。 Custom Keyboard
【讨论】:
你应该看看 ImeActionLabel 或 ImeActionId
<EditText android:id="@+id/some_edittext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:imeOptions="actionSend">
</EditText>
【讨论】: