In my app,I have an edittext and a PopupWindow.
I want to show the popup once the user starts editing the text. but when I show the popup, it graps the focus from the edittext, and the virtual keyboard is dismissed (and I want it shown).
I tried creating the popup as not focusable, but then I can't select it after it's shown.
I also tried changing the focus and selection attributes of both edittext and from code after and before the popup is shown, but if the popup is created as not focusable, I can't select it after it's shown.
Is there a way of displaying a selectable popup along with editing the edittext?
You could try going in other direction. you have to control the input method editor (IME). every editable has an appropriate IME (also edittext has). You can control the IME - for example to be shown all the time not regarding to the state of edittext and dismiss it when you click on something or something happen.
You can ovveride the default editext implementation or you can control the IME at the viewgroup container/activity level.
http://developer.android.com/resources/articles/on-screen-inputs.html (read the APIs for controlling IMEs at the end).
hope this will help.
Related
I want to show softkeyboard after tapping on EditText in my custom Softkeyboard.
I have made one custom keyboard in which I've added one key.
This key will navigate you to a Conversion View which contains an EditText.
So after tapping on that EditText I want to open my own custom softkeyboard.
Please reply me as soon as possible.
You have two options: create a soft keyboard using the InputMethodService--that is, create a true soft keyboard that will be listed under the keyboard listing in the device's settings that the user can turn on and use at any time. That can be a lot of work.
You're other option is to mock the soft keyboard by creating a custom view, of which you handle input and toggle the visibility of explicitly in your app; blocking the native soft keyboard from showing (which you can do per activity via your manifest or in code).
I have an EditText on a ScrollView in an Activity that has
android:windowSoftInputMode="adjustResize"
set.
I'm trying to anchor another (popup) view to that EditText, that appears if there is invalid text entered.
In order to anchor it,
EditView.getLocationOnScreen();
is called. So far, so good.
But I'm also dismissing the keyboard when the popup view appears, and if the EditText moved above the keyboard for text entry, then the EditText moves back down to the original position, but the popup appears where the EditText was (when the keyboard was showing).
If I log the location points with (getLocationOnScreen())for the EditText before and after keyboard dismiss, I can see they are the same.
My question - Is there a way to update the EditText location after the keyboard is dismissed?
If it helps, I'm using https://github.com/lupidan/PopoverView for the popup, but this to me is an issue outside of that code.
A better option than using a library that emulates a control from a different platform would be to use what is already built into the Android SDK. PopupWindow (docs links) would allow you to provide this same functionality and properly anchor the content to the EditText view. It can be passed a content view just like an activity or dialog, so the API is more consistent.
When you display a PopupWindow with showAsDropDown(), the framework will maintain the anchor position to the supplied view when operations like scrolling occur.
I have a popup that has a multi-line edit text and can appear at arbitrary position atop my application. Currently I have implemented it as a transparent activity. When the keyboard is shown over the popup, it jumps up and the current line is shown above the keyboard (I have the adjustPan flag set).
Now, I want the whole popup to go up and show above the keyboard, not only one line of text box. I was able to achieve this by moving focus to the whole layout when the EditText is focused, but then, well, the EditText loses focus, and I cannot type. Is there any other way way to do this? Or is there a way to focus a view without losing focus on another?
I have an application, where I have a list view, and list view is made upon custom adapter. I have made a suggestive search on list view. My problem is that, when I am about to type something in edit text search pan; then soft keyboard pop up gets full length by width and height in the screen, so I have no option to see whether my list view is getting changed on text change in edit text. I am being enable to see search result until I press done button in soft keyboard. I want soft keyboard pop up just pops up half the screen of my application so that I can see my listview data changes on text change given in edit text. Is there any solution related to my issue???
Add to your EditText the attribute android:imeOptions="flagNoExtractUi". This will prevent the soft keyboard to take full-screen size.
Check this answer: Disabling the fullscreen editing view for soft keyboard input in landscape?
I've got an Android application I'm writing. It has a ListActivity in it that's all set up to load my data using this layout for each item.
My data Adapter binds with no problem and I've set it up so that when an item is selected from the list this method is called.
private void showPasswordBox(View v) {
EditText passwordBox = (EditText)v.findViewById(R.id.hidden_box);
Button passwordSubmit = (Button)v.findViewById(R.id.hidden_box_submit);
passwordSubmit.setText("Login");
passwordSubmit.setVisibility(View.VISIBLE);
passwordBox.setFocusableInTouchMode(true);
passwordBox.setHint(R.string.password);
passwordBox.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
passwordBox.setVisibility(View.VISIBLE);
}
This has the effect of displaying and EditText and a Button (hidden_box and hidden_box_submit in my layout). Which is just what I wanted.
However a problem occurs when the user taps on the newly visible EditText (hidden_box). The IME pops up and hidden_box immediately loses focus. Consequently anything typed on the IME does not appear in the EditText. Instead it's doing this weird thing where anything typed appears above the keyboard in grey letters and remains at the bottom of the screen when the IME is dismissed. It's like the IME is typing into it's own temporary invisible box.
If the user taps on the EditText after the IME is already showing then the application behaves as it should. Anything typed on the IME appears in the EditText and remains when the IME is dismissed.
It seems to me that when the IME pops up (which it does immediately when the user taps on the EditText, as it should) it completely de-associates with my application and does its thing in IME la-la land unless I direct it to the EditText by tapping on the EditText before typing and dismissing the keyboard. How do I make it behave normally so it types directly into the EditText as soon as it pops up?
passwordBox.setFocusableInTouchMode(true);
Hope this will work. Does it?