Disabling the fullscreen editing view for soft keyboard input in landscape?
I finally answered my own question:
The extract UI (i.e. the fullscreen editing mode) can be disabled at the point at which the input connection is hooked up:
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI;
// etc.
}
Disabling the fullscreen editing view for soft keyboard input in landscape, from a user perspective?
According to the docs:
IME_FLAG_NO_EXTRACT_UI: For input methods that may be fullscreen, often when in landscape mode, this allows them to be smaller and let part of the application be shown behind. Though there will likely be limited access to the application available from the user, it can make the experience of a (mostly) fullscreen IME less jarring. Note that when this flag is specified the IME may not be set up to be able to display text, so it should only be used in situations where this is not needed.
Because a phone has smaller screen real estate, it may make it harder for the user to see the entire UI and be able to operate it correctly, especially if you have some "taller" UI elements which may not fit into screen in landscape mode.
Update: Looking at an OS-level perspective, the solution lies within (at least in ICS) android/inputmethodservice/InputMethodService.java:2107
:
/**
* Called when the fullscreen-mode extracting editor info has changed,
* to determine whether the extracting (extract text and candidates) portion
* of the UI should be shown. The standard implementation hides or shows
* the extract area depending on whether it makes sense for the
* current editor. In particular, a {@link InputType#TYPE_NULL}
* input type or {@link EditorInfo#IME_FLAG_NO_EXTRACT_UI} flag will
* turn off the extract area since there is no text to be shown.
*/
public void onUpdateExtractingVisibility(EditorInfo ei) {
if (ei.inputType == InputType.TYPE_NULL ||
(ei.imeOptions&EditorInfo.IME_FLAG_NO_EXTRACT_UI) != 0) {
// No reason to show extract UI!
setExtractViewShown(false);
return;
}
setExtractViewShown(true);
}
To remove this functionality you would have to override onUpdateExtractingVisibility(EditorInfo)
and call perhaps setExtractViewShown(false)
within without calling super
.
Can you disable fullscreen editing in landscape in React Native Android?
Starting from v0.40.0 React Native's TextInput
has the prop disableFullscreenUI
, which sets imeOptions="flagNoExtractUi"
internally.
<TextInput disableFullscreenUI={true} />
Keyboard opens as full screen in landscape mode
Basically its not a bug of your application. Its how your keyboard IME is designed. When user goes to landscape mode, it'll take up the whole screen.
You may install some third party IME from play store and see how it works in portrait mode.
As per the link given by MCeley below. You can do something as below
@Override
public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
outAttrs.imeOptions = EditorInfo.IME_FLAG_NO_EXTRACT_UI;
}
or change your manifest for your activity as below
android:imeOptions="flagNoExtractUi"
Read here for more discussion
How to disable custom keyboard fullscreen?
The following code in InputMethodService should solve your problem:
@Override
public boolean onEvaluateFullscreenMode() {
return false;
}
Force full screen editing view for keyboard input in landscape?
You can't. Its actually up to the keyboard whether it enters extract mode or not. There's a function on the InputMethodService they can override to define what conditions they use it in. There is no way to override the keyboard's choice if they decide not to use it (I believe you can request they not use it, but in the end its still the keyboard's decision.
how to disable full screen keyboard
I managed to do it using this:
public override IInputConnection OnCreateInputConnection(EditorInfo outAttrs)
{
outAttrs.ImeOptions = ImeFlags.NoExtractUi;
IInputConnection ret= base.OnCreateInputConnection(outAttrs);}
Is there a way to avoid having fullscreen SearchView/Keyboard on landscape?
It took me a while to figure this one out, but it's actually quite simple.
Initially I created a custom class that extended the SearchView class, and used a onCreateInputConnection()
override, however I couldn't get it working that way.
I eventually got it working in a much more simple way, with just two added lines of code.
You just need to call search.getImeOptions()
to get the current configuration, and then "or" the result with EditorInfo.IME_FLAG_NO_EXTRACT_UI
with a call to setImeOptions()
:
Java:
search.setImeOptions(options|EditorInfo.IME_FLAG_NO_EXTRACT_UI);
Kotlin:
search.setImeOptions(search.imeOptions or EditorInfo.IME_FLAG_NO_EXTRACT_UI)
If you don't "or" with the existing options, then you don't get the "Search" completion button in the lower right, you just get a "Done" button instead.
Here is the full onCreateOptionsMenu()
override I used to test (I used a SearchView in the xml, but this solution should work for you even if you're not inflating your SearchView from xml):
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.menu_main, menu);
SearchManager manager = (SearchManager) getSystemService(Context.SEARCH_SERVICE);
SearchView search = (SearchView) menu.findItem(R.id.action_search).getActionView();
SearchableInfo si = manager.getSearchableInfo(getComponentName());
//Here is where the magic happens:
int options = search.getImeOptions();
search.setImeOptions(options|EditorInfo.IME_FLAG_NO_EXTRACT_UI);
//!!!!!!!!!!!
search.setSearchableInfo(si);
search.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
}
@Override
public boolean onQueryTextChange(String query) {
return true;
}
});
return true;
}
Here is the xml I used for the SearchView in menu_main.xml:
<item android:id="@+id/action_search"
android:title="Search"
android:icon="@android:drawable/ic_menu_search"
app:showAsAction="always"
app:actionViewClass="android.support.v7.widget.SearchView"
/>
Result without the call to setImeOptions()
:
Result with the call to setImeOptions()
:
Related Topics
How to Define a Min and Max Value For Edittext in Android
Android Error: Failed to Install *.Apk on Device *: Timeout
How to Change Colors of a Drawable in Android
Android: How to Have Viewpager Wrap_Content
How to Change the Text on the Action Bar
Intercepting Links from the Browser to Open My Android App
Android Create Shortcuts on the Home Screen
How to Return a Result (Startactivityforresult) from a Tabhost Activity
How to Make a Phone Call in Android and Come Back to My Activity When the Call Is Done
Difference Between Getdefaultsharedpreferences and Getsharedpreferences
How to Disable Mobile Data on Android
Android.View.Inflateexception: Binary Xml File Line #12: Error Inflating Class ≪Unknown≫
Difference Between Adjustresize and Adjustpan in Android
Java.Lang.Runtimeexception: Unable to Instantiate Activity Componentinfo
Runtimeexception: Your Content Must Have a Listview Whose Id Attribute Is 'Android.R.Id.List'
Android Studio Keeps Refusing to Resolve Com.Android.Support:Appcompat-V7:29.0.1