Show Keyboard just beneath/under the focused editText - android

I could able to show the decimal keyboard on android. However, I need to know how could I show the keyboard just under the focused editText or TextView in a popover/fragment?
android:inputType="numberDecimal"

You can't. The keyboard itself is responsible for where it draws. Which unless they go to a lot of work to override it, is always at the bottom of the screen. If you absolutely need that, you need to implement a pseudo-keyboard of your own.

In your AndroidManifest.xml set the android:windowSoftInputMode attribute to adjustResize for the activity containing your EditText as following.
<activity
android:name=".MainActivity"
android:windowSoftInputMode="adjustResize"
/>
Hope this is helpful.

Related

Android- Change The height of EditText when softkeyboard is on

I am having an activity in fragment where there is an editbox and 3 buttons below the editbox. Please see attachment. When this activity is launched, the default state is STATE1.(Please see image). Now when the user types on the editText and when the keyboard is shown the buttons in STATE1 disappears and goes to STATE2.
but I want when the keyboard appear it sould go to STATE3 and not STATE2
I am not sure how to accomplish this. I have the height of the edittext hardcoded to some dp based on the target device. I believe this has to be changed. Can anyone help me in how to accomplish this.
Try this in manifest:
<activity
android:name=".activity.YourActivity"
android:label="#string/app_name"
android:screenOrientation="portrait"
android:windowSoftInputMode="adjustResize|stateHidden" />
Instead of adjustResize you can also try adjustPan.
Hope this helps.

how to move the entair screen up when keyboard enabled?

I want to scroll up the entair screen up when keyboard opened like below.How to do that?
https://www.screencast.com/t/34JwVngLdYbU
Apply android:windowSoftInputMode="adjustPan|adjustResize" with activity tag in manifest file.
android:windowSoftInputMode="adjustPan|adjustResize"
and put complete layout in LinearLayout and ScrollView & define
layout_height="0dp"
layout_weight="1"
Note: No view have parameter layout_height="match_parent"
I had also same issue just adding a single line to my AndroidManifest file's activity.
<activity
android:name=".activities.YOURACTIVITY"
android:screenOrientation="portrait"
android:theme="#style/AppTheme.NoActionBar"
android:windowSoftInputMode="adjustResize|stateVisible"/>
If you want keyboard should appear with start Activity then use stateVisible otherwise use stateHidden.
Here the most important value is the adjustResize. This will shift the whole UI up to give room for the softkeyboard.

moving edit text along with soft keyboard android

I am having an comment edit text in my application. The edit text is aligned at the bottom of the screen. when edit text is focused i want to move edit text alone with soft keyboard without changing other views in layout similar to comment edit box in facebook. I tried adjustpan in manifest but it moves all views up with soft keyboard. adjustresize in manifest hides some view.please provide suggestions.
Try like this inside your Android manifest file..
<activity name="YourActivity"
android:windowSoftInputMode="stateVisible|adjustResize">
</activity>
or
<activity name="YourActivity"
android:windowSoftInputMode="stateVisible|adjustPan">
</activity>
Please also read this for ref/Clarity
Add
android:windowSoftInputMode="adjustPan"
in your AndroidManifest file (in activity property)
dialog.getWindow().
setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE);
Its also working with out manifest file entry

how to close android keypad popup for edittext but i need keypad below edittext

I need keypad for EditText its overlaps my EditText but i need keypad below the EditText view.
EDIT:
finally i got the answer for this. we need to set
android:imeOptions="flagNoExtractUi" in `edittext`
it hides the popup.
You will need to set android:windowSoftInputMode or android:windowSoftInputMode to to make room for the soft keyboard without hiding EditText
<activity android:windowSoftInputMode="adjustResize" />
or
<activity android:windowSoftInputMode="adjustPan" />
All you need is set this parameter android:windowSoftInputMode="adjustPan" in your AndroidManifest for your Activity class.

Android soft keyboard covers EditText field

Is there a way to make the screen scroll to allow the text field to be seen?
I had same issues. Try following code:
android:windowSoftInputMode="adjustPan"
add it to your manifest.xml in the activity tag of the activity that holds the input. example:
<activity
android:name=".Activities.InputsActivity"
...
android:windowSoftInputMode="adjustPan"
/>
Are you asking how to control what is visible when the soft keyboard opens? You might want to play with the windowSoftInputMode. See developer docs for more discussion.
I had the same issue where the softkeyboard was on top of the EditText views which were placed on the bottom of the screen. I was able to find a solution by adding a single line to my AndroidManifest.xml file's relevant activity.
android:windowSoftInputMode="adjustResize|stateHidden"
This is how the whole activity tag looks like:
<activity
android:name="com.my.MainActivity"
android:screenOrientation="portrait"
android:label="#string/title_activity_main"
android:windowSoftInputMode="adjustResize|stateHidden" >
</activity>
Here the most important value is the adjustResize. This will shift the whole UI up to give room for the softkeyboard.
Why not try to add a ScrollView to wrap whatever it is you want to scroll. Here is how I have done it, where I actually leave a header on top which does not scroll, while the dialog widgets (in particular the EditTexts) scroll when you open soft keypad.
<LinearLayout android:id="#+id/HeaderLayout" >
<!-- Here add a header or whatever will not be scrolled. -->
</LinearLayout>
<ScrollView android:id="#+id/MainForm" >
<!-- Here add your edittexts or whatever will scroll. -->
</ScrollView>
I would typically have a LinearLayout inside the ScrollView, but that is up to you. Also, setting Scrollbar style to outsideInset helps, at least on my devices.
All you need to do is
android:isScrollContainer="true"
source: http://www.davidwparker.com/2011/08/25/android-fixing-window-resize-and-scrolling/
Sorry for reviving an old thread but no one mentioned setting android:imeOptions="flagNoFullscreen" in your EditText element
android:windowSoftInputMode="adjustPan"
android:isScrollContainer="true"
works for android EditText, while it not works for webview or xwalkview. When soft keyboard hide the input in webview or xwalkview you have use android:windowSoftInputMode="adjustResize"
I believe that you can make it scroll by using the trackball, which might be achieved programmatically through selection methods eventually, but it's just an idea. I know that the trackball method typically works, but as for the exact way to do this and make it work from code, I do not sure.
Hope that helps.
add this single line to your relative activity where key board cover edit text.inside onCreat()method of activity.
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE | WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
just add
android:gravity="bottom" android:paddingBottom="10dp"
change paddingBottom according to your size of edittext
I know this is old but none of the above solutions worked for me. After extensive debugging, I figured out the issue.
The solution is setting the android:windowTranslucentStatus attribute to false in my styles.xml
If EditText Field is been covered by the KeyBoard Use the following code:
EditText= findViewById(R.id.edittext)
EditText?.getParent()?.requestChildFocus(EditText,EditText)
If you want the Cursor to be in the Focused EditText than use EditText.requestFocus() after the EditText?.getParent()?.requestChildFocus(EditText,EditText) which helps to get the focus and Cursor in the Focused EditText.
The above solution work perfectly but if you are using Fullscreen activity(translucent status bar) then these solutions might not work.
so for fullscreen use this code inside your onCreate function on your Activity.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow();
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN , WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN );
getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.TYPE_STATUS_BAR);
}
Example:
protected void onCreate(Bundle savedInstanceState) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow();
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN , WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN );
getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.TYPE_STATUS_BAR);
}
super.onCreate(savedInstanceState);
Edit your AndroidManifest.xml
android:windowSoftInputMode="adjustResize"
Add this to your root view of Layout file.
android:fitsSystemWindows="true"
That's all.
I had the same issue and searching the people said to add adjustPan, while in my case adjustResize worked.
<activity
android:name=".YOUR.ACTIVITY"
...
android:windowSoftInputMode="adjustResize"
/>

Categories

Resources