Tag: android softkeyboard

只在Android软键盘上显示数字button?

在Android的软键盘上,您可以使用android:inputType="numberDecimal"来设置软键盘来显示数字,而不是使用az键盘。 但是,如果我只想显示顶部数字行1 2 3 4 5 6 7 8 9 0 ,而不是以@ # $ % …开始的以下行,该怎么办? 谢谢!

在片段启动时显示edittext的键盘

当我的片段开始时,我想让我的edittext处于焦点/让用户开始input它。 我可以通过requestFocus()获得焦点,但是我不能让键盘显示出来。 我已经试过这两个: edit = (EditText) view.findViewById(R.id.search); edit.requestFocus(); InputMethodManager imgr = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imgr.showSoftInput(edit, 0); 和 edit = (EditText) view.findViewById(R.id.search); InputMethodManager imgr = (InputMethodManager) getActivity().getSystemService(Context.INPUT_METHOD_SERVICE); imgr.showSoftInput(edit, 0); edit.requestFocus(); 如何让键盘显示EditText?

如何以编程方式closuresAndroid软键盘?

我目前使用下面的代码显示softkeyboard InputMethodManager imm = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); imm.toggleSoftInput (InputMethodManager.SHOW_FORCED, InputMethodManager.RESULT_HIDDEN); 在这里,我没有绑定与Edittext软键盘,因为我已经使用了上述代码。 现在我想closuresSoftKeyboard,所以我目前使用下面的代码,但它不工作。 imm.toggleSoftInput (InputMethodManager.SHOW_FORCED, InputMethodManager.RESULT_HIDDEN); 任何人都可以build议我用什么来closuressoftKeyboard? 基于下面的答案我想让你清楚,我没有使用EditText,我使用布局,我想显示键盘和隐藏键盘。 我想发送键盘按键事件远程区域bcoz我没有使用editText。

在键盘上添加视图android

在我的Android应用程序中,我有一个聊天活动,我使用这个代码从android-chat-starter 问题是在模拟器一切工作正常,我testing了许多types的模拟器(api> 18,api = 18,api <18),但在实际设备的testing中,它的行为就像在这个图像 在键盘上方显示表情符号视图 这里是我用来显示表情符号视图的代码 private void showEmojiPopup(boolean show) { showingEmoji = show; if (show) { if (emojiView == null) { if (getActivity() == null) { return; } emojiView = new EmojiView(getActivity()); emojiView.setListener(new EmojiView.Listener() { public void onBackspace() { chatEditText1.dispatchKeyEvent(new KeyEvent(0, 67)); } public void onEmojiSelected(String symbol) { int i = chatEditText1.getSelectionEnd(); […]

显示对话框的软键盘

我正在显示edittext视图的对话框。 但是,软键盘只有在用户在编辑视图中按下时才会打开。 所以我试着用下面的代码调用一个InputMethodManager。 InputMethodManager imm = (InputMethodManager)getSystemService(Context.INPUT_METHOD_SERVICE); imm.showSoftInput(dialogField,0); dialogField是input字段。 但是,到底什么时候我应该这样做呢? 我在对话框的onStart()方法中试过,但没有任何反应。 我也尝试请求对话框的焦点之前,但这并没有改变。 我也试过这个代码 dialogField.setOnFocusChangeListener(new View.OnFocusChangeListener() { public void onFocusChange (View v, boolean hasFocus) { if (hasFocus) { Main.log("here"); dialogInput.getWindow().setSoftInputMode( WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE); /* InputMethodManager mgr = (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE); mgr.showSoftInput(dialogField,0); */ } } }); 在这两个版本。 但是没有软键盘想出现。 Main.log只是一个日志,它显示了这个函数实际上是被调用的。 是的,它被称为。 在打开对话框之前,我可以使用SHOW_FORCED标志来获取键盘。 但是,它不会在退出时closures。 而我只能做到这一点之前,我显示对话框。 在任何callback里面,它也不起作用。

有没有什么办法从Java类更改android:windowSoftInputMode值?

我想要执行我的选项卡为每个选项卡具有不同的windowSoftInputMode属性。 如果从一个单一的活动完成你的标签的所有处理,如何从Java类访问此属性? 有什么办法从Java代码访问这个清单属性?

android:Softkeyboard按下完成键时执行操作

我有一个EditText。 我想要input一些文本后,当用户按下softkeybard的完成键,它应该执行一些search操作,我也实现了一个button点击事件。 怎么做…???

在ListView中的EditText在Android 4.x上按下时失去焦点

我知道这里有很多类似的问题,但是我不能在简单的示例应用程序中获得任何提供的解决scheme。 第一次显示软键盘时会出现问题。 一旦显示,只需再次按editText使其可编辑。 试过以下几点: android:windowSoftInputMode="adjustPan|adjustResize" 这不是解决任何问题。 似乎这个行是强制性的软键盘popup后,调整活动。 不幸的是,这也导致任何EditTexts失去焦点。 这可能是ListView本身在resize过程之后获得焦点。 所以我尝试了以下解决方法: listView.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS); 这总是会导致ListView包含的第一个可见的EditText获得焦点,这是不可取的。 第二行中的第二个EditText应该在按下时获得焦点,这不会发生。 另外,如果我最终设法聚焦另一个EditText,然后显示第一个EditText(例如,通过按下softkeyboard键盘上的“Next”),第一个可见的将在键盘被解散并且ListView被重新调整到其全尺寸。 我尝试了几个其他的东西,例如拦截ListView的onFocusChange()事件,同时知道TouchListener按下了哪个EditText。 再次请求某个EditText的焦点也没有导致任何成功。 使用ScrollView而不是其他用户build议的ListView而不是相关项目的选项。

如何隐藏片段内的软键盘?

我有一个使用ViewPager服务几个片段的FragmentActivity 。 每个是具有以下布局的ListFragment : <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="fill_parent" android:layout_height="fill_parent"> <LinearLayout android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent" android:padding="8dp"> <ListView android:id="@id/android:list" android:layout_width="fill_parent" android:layout_height="fill_parent" /> <EditText android:id="@+id/entertext" android:layout_width="fill_parent" android:layout_height="wrap_content" /> </LinearLayout> </LinearLayout> 当开始活动时,软键盘显示。 为了解决这个问题,我在片段内部做了以下操作: @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { //Save the container view so we can access the window token viewContainer = container; //get […]

Android:对话框中的EditText不能拉起软键盘

所以我得到了什么似乎是一个常见的问题,这是我的对话框中的EditText不会显示时,它得到的焦点。 我已经看到了几个解决方法,比如在这个线程中 , 这个和这个 (还有更多),但是我从来没有看到一个令人满意的解释, 为什么这首先发生。 我更喜欢让android自己使用EditTexts的默认行为,而不是构build我自己的,但似乎每个人(在这些线程中)已经接受了对话框中的EditTexts的默认行为是只给一个游标,没有键盘。 为什么会这样? 对于logging,这些解决方法似乎没有任何工作对我来说 – 最近我已经能够迫使键盘出现在对话框下面 (使用InputMethodManager.toggleSoftKeyboard(*))。 我的特定configuration是API15,EditText显示在AlertDialog中的ListView的页脚上。 EditText android:focusable =“true”已设置,onFocusChangeListener 正在接收焦点事件。 编辑: 根据要求,这里是我正在使用的特定的代码片段。 我不打扰整个布局,但在这个特定的应用程序中,EditText出现在响应按下对话框上的button(类似于一个动作视图 )。 它包含在一个RelativeLayout中,默认情况下它的可见性已经“消失”了: <RelativeLayout android:id="@+id/relLay" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_centerVertical="true" android:visibility="gone" android:layout_marginTop="5dp" android:layout_marginBottom="5dp"> <ImageButton android:id="@+id/cancelBut" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:background="@color/transparent" android:src="@drawable/cancelButton" android:layout_margin="5dp"/> <ImageButton android:id="@+id/okBut" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toLeftOf="@id/cancelBut" android:background="@color/transparent" android:src="@drawable/okButton" android:layout_margin="5dp" /> <EditText android:id="@+id/editText" android:layout_width="match_parent" android:layout_height="wrap_content" android:inputType="text" android:focusable="true" android:layout_toLeftOf="@id/okBut"/> </RelativeLayout> […]