如何使用软键盘更改Android中的按钮文本?
如何使用软键盘在按钮中输入文本。因此,按下按钮,软键盘将打开并由用户输入文本如何使用软键盘更改Android中的按钮文本?,android,Android,如何使用软键盘在按钮中输入文本。因此,按下按钮,软键盘将打开并由用户输入文本 public static void showKeyboard(View view) { InputMethodManager mgr = (InputMethodManager)myContext.getSystemService(Context.INPUT_METHOD_SERVICE); mgr.showSoftInput(view, InputMethodManager.SHOW_IMPL
public static void showKeyboard(View view)
{
InputMethodManager mgr = (InputMethodManager)myContext.getSystemService(Context.INPUT_METHOD_SERVICE);
mgr.showSoftInput(view, InputMethodManager.SHOW_IMPLICIT);
((InputMethodManager)myContext.getSystemService(Context.INPUT_METHOD_SERVICE)).showSoftInput(view, 0);
}
此代码用于打开软键盘。你可以把这个放在你的按钮上。但我不确定是否要在按钮上键入内容。这是我第一次遇到。为什么不使用editText?请尝试使用editText的样式类型按钮。请参阅下面的XML代码
<EditText
android:id="@+id/buttonedittext"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:text="test"
style="@android:style/Widget.Button" />
我显示像按钮,也当你们点击它显示软键盘,你们可以键入任何你们想要的
希望对您有用:)根据客户要求,需要在按钮中输入文本。不使用编辑文本。