Android- Change The height of EditText when softkeyboard is on - android

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.

Related

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.

Show Keyboard just beneath/under the focused editText

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.

adjustResize not happening

My manifest file looks like
<activity
android:label="#string/app_name"
android:icon="#drawable/ew_logo"
android:theme="#style/AppTheme"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize"
android:windowSoftInputMode="adjustResize"
android:name="activity.MainActivity">
</activity>
My Mainactivity contains custom toolbar and Edittext in vertical orientation. When keyboard popouts in HTC(landscape mode), am able to see only edittext not toolbar. I want the view like adjustresize not adjust pane.
Try this. mEditText.setImeOptions(EditorInfo.IME_FLAG_NO_EXTRACT_UI);
You can also do it from the xml file using
android:imeOptions="flagNoExtractUi"
From the documentation
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.
Whats the activity layout you're using? you should wrap it with scrollview for adjustResize to work.

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

Android : Realign layout after screen keyboard auto suggestions complete

I hope that makes sense...
Basically when the on screen keyboard appears and then the auto suggestions as well, it pushes my view up the screen - a graphic in an imageView that I would like to persist.
When the auto complete is over and done with, the screen stays where is is despite the auto suggest disappearing.
Is there any way to let my layout reclaim that space and simply go back down again into the empty space ? ie to float back down again ?
Cheers :)
If I got you right, try adding the following line to the <activity> in your manifest:
<application
android:icon="#drawable/icon"
android:label="#string/app_name">
<activity
...
android:windowSoftInputMode="adjustPan"
...>
...
</activity>
...
</application>

Categories

Resources