#1 2016-04-05 22:46:15

tin
Member
Registered: 2016-03-20
Posts: 161

Android : Is there a way to stop the keyboard from resizing the view?

I try to fix this problem 2 days..
I have 3 Case
Case 1 input box show in upper layout
I don't want view to resize after keyboard show like picture
fxxe6c.jpg
So.I can fix it by Set app to fullscreen or edit file AndroidManifest.xml manually
from

android:windowSoftInputMode="adjustResize"

to

android:windowSoftInputMode="adjustPan"

2r756aq.jpg
try to add in cordova config.xml with

<preference name="android-windowSoftInputMode" value="adjustPan" />

cannot work then I edit it manual
So,My layout not break I Fix It.

Case 2 input box in lower layout
I want view to scroll up and focus input box after keyboard show
io3yqe.jpg
I don't know to fix this... T__T

Case 3 I have upper and lower input box in the same app but in another view
like 2 case,but if I have 2 view,first one like Case1.Another view like Case2.In the same App.
How can I specific layout view to lock layout like Case1 or focus to input box like Case2 ?
Can we set windowsoftinputmode programmatically?

Ps.I try to use keyboard plugin too. (https://github.com/driftyco/ionic-plugin-keyboard)

my ref:
http://stackoverflow.com/questions/1007 … g-the-view
http://stackoverflow.com/questions/1500 … -makes-the
http://stackoverflow.com/questions/3281 … css-layout
https://groups.google.com/forum/#!topic … FmIeUJBnvQ
http://stackoverflow.com/questions/7020 … rd-invoked
http://stackoverflow.com/questions/2684 … config-xml

Last edited by tin (2016-04-05 22:47:34)

Offline

#2 2016-04-05 23:14:38

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: Android : Is there a way to stop the keyboard from resizing the view?

Hello,

Are you using the "Scaled" app's option? In my tests this is the best option for mobiles and the keyboard behaviour is better (in my opinion) because the app is scaled occupied the space leave by the keyboard. The "Fullscreen" option is not recommended for normal apps: probably games and some apps can need it, but in my tests the "Fullscreen" can also interfere with the keyboard behaviour.

So in conclusion:

1º Use the "Scaled" app's option

2º Do not use the "Fullscreen" app's option

Try it and look how the keyboard behaviour. I think it's not a problem if the app layout "scaled" to the free space: in fact the keyboard must be shown to do the work... On the other hand, I can't found in the Cordova's documentation the Android option you mentioned, then maybe you can use it, but manually editing the Android's manifest file.

Online

#3 2016-04-05 23:31:24

tin
Member
Registered: 2016-03-20
Posts: 161

Re: Android : Is there a way to stop the keyboard from resizing the view?

In 2 case,I didn't use fullscreen app,david.I just fix it by edit androud manifest.
And what is "scale" app option? where can I set it?

Offline

#4 2016-04-05 23:40:38

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: Android : Is there a way to stop the keyboard from resizing the view?

Hello,

Of course you need to try with the "Scaled" option if you are not used before:

From the object inspector:

IJkLiPc.png

From the app's options dialog:

EyISjy3.png

Online

#5 2016-04-05 23:49:14

tin
Member
Registered: 2016-03-20
Posts: 161

Re: Android : Is there a way to stop the keyboard from resizing the view?

Hi David, that option I already(and alway) use it and give result as in picture 2 in 2 case.It make layout break.It resize layout to fit space that make layout broken for some device(cannot read because it resize after keyboard show) it not fix my case 2 problem

Offline

#6 2016-04-06 07:36:47

tin
Member
Registered: 2016-03-20
Posts: 161

Re: Android : Is there a way to stop the keyboard from resizing the view?

So,I want layout not resize.I want layout to scroll up(resize will destroy layout because header is fix)
ayuf5e.jpg
How can we do this?
In case of layout break like sample picture below
9zt1kl.jpg

It easier when explain with picture tongue

Offline

#7 2016-04-06 08:22:12

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: Android : Is there a way to stop the keyboard from resizing the view?

Hello,

This is strange. You are saying the keyboard leave the layout "reduced" after the keyboard is closed? This is what I can't understand, because this is not the behaviour in my tests. In my tests the layout is "scaled" when the keyboard is displayed, and then the layout is "scaled" again, that is, when the keyboard is hide...

Online

#8 2016-04-06 09:15:29

tin
Member
Registered: 2016-03-20
Posts: 161

Re: Android : Is there a way to stop the keyboard from resizing the view?

David wrote:

Hello,

This is strange. You are saying the keyboard leave the layout "reduced" after the keyboard is closed? This is what I can't understand, because this is not the behaviour in my tests. In my tests the layout is "scaled" when the keyboard is displayed, and then the layout is "scaled" again, that is, when the keyboard is hide...

No no,not "reduce after close".I mean "when the keyboard was show up",the "the layout scale" will resize to "fit view".I just want layout not to fit in view.But can scroll up to focus in input box when keyboard show.

something like this
Scrollable form in Android when the virtual keyboard is open

another question is Can we change "android:windowSoftInputMode" by any javascript?

Offline

#9 2016-04-06 09:28:08

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: Android : Is there a way to stop the keyboard from resizing the view?

Hello,

One question (I think important), are you using the Fullscreen option tin?

Online

#10 2016-04-06 09:33:24

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: Android : Is there a way to stop the keyboard from resizing the view?

Hello,

About the option:

<preference name="android-windowSoftInputMode" value="stateVisible|adjustResize" />

I am investigating, but, if you wanted, you can try it by placing the above option (XML element) into the Cordova's configuration Extra XML option:

3q821Tk.png

Take a look here too for possible "android-windowSoftInputMode" values:

http://developer.android.com/intl/es/gu … html#wsoft

Online

#11 2016-04-06 10:04:28

tin
Member
Registered: 2016-03-20
Posts: 161

Re: Android : Is there a way to stop the keyboard from resizing the view?

David wrote:

Hello,

One question (I think important), are you using the Fullscreen option tin?

No,David.This is my config
w7ipg4.jpg

And about set android-windowSoftInputMode,I already try it.After run cordova to generate project,in AndroidManifest.xml still not change.Then I manual edit it.

this link like I want it to be
http://unitid.nl/androidpatterns/uap_pa … d-pan-scan

I searching some topic told me to use scrollView that will fix this situation,But we don't have scrollview in app builder?

Offline

#12 2016-04-06 10:25:04

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: Android : Is there a way to stop the keyboard from resizing the view?

Hello,

The point is that the "android-windowSoftInputMode" appear in the Phonegap documentation (maybe old?) but not in the recent versions of Apache Cordova. Maybe, for some reason, this option is not take in consideration. And about the "ScrollView" it's Apache Cordova who does not uses something like that... except maybe by using some thirdty party plugin.

But I want to get back to the main question of this thread tin. After test the "Validator" app sample, which contains lot of Text Input controls, I found the behaviour you mentioned: the layout is "break" after the keyboard is show/hide. However, what I try is to uncheck the "Allow user zoom" option, which is checked by default:

AoiNt9z.png

After doing that, I try again with the "Validator" app sample, and certainly I can view the expected behaviour:

1. The view is scaled when the keyboard appear.

2. We can select any input control to enter data.

3. After the keyboard is hide, the app layout is restored (not breaked).

The problem now is I can see this "Allow user zoom" option unchecked in your app options (above)... but maybe you can verify that. As I say, the behaviour I experiment with the "Validator" sample is good and allow us to enter input data without problems or layout breaks.

Online

#13 2016-04-06 10:29:48

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: Android : Is there a way to stop the keyboard from resizing the view?

Hello,

Just to add that I try also with the "GoogleMaps" app sample and the things works like expected: the layout is not broken here in my Android 4.4.2 device. The app is scaled when the keyboard appear and then is scaled again when the keyboard is hidden.

1. App started

WmHrE1R.png

2. Keyboard is shown

yiZqLzo.png

3. Keyboard is hidden

fzTcAwN.png

Online

#14 2016-04-06 15:02:17

tin
Member
Registered: 2016-03-20
Posts: 161

Re: Android : Is there a way to stop the keyboard from resizing the view?

Hi David.I know what you want to tell me.But this is what I ask you.(I set it as .gif movie to tell you what I mean)
So.This is normal state that App builder do.

xTiQyem7M6kafkdYYg.gif

And This was I mean and find out how to do with App builder and cordova.

l0O7OeyEOFPYJ9diE.gif

This will be great resource who find out for input box with view not resizing.

Offline

#15 2016-04-06 15:05:34

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: Android : Is there a way to stop the keyboard from resizing the view?

Hello,

Yes; in fact, to me the first approach is good enough, but, the second one also looks good.

How do you get it done tin?

Online

#16 2016-04-06 15:14:32

tin
Member
Registered: 2016-03-20
Posts: 161

Re: Android : Is there a way to stop the keyboard from resizing the view?

The second one I use B4A(Basic4Android),David. lol
It have Event FocusChanged on inputBox.And set scroll position by
ScrollPosition = InputboxTopposition - 10dip
then fire event like that.(I translate code to easy understand the normal code is vb)
It use container panel to scroll.

Offline

#17 2016-04-06 15:20:59

tin
Member
Registered: 2016-03-20
Posts: 161

Re: Android : Is there a way to stop the keyboard from resizing the view?

Is AppBuilder have event to set position scrollview or panel or container?

View resize is good.But if you have small screen device with big keyboard.And you have image in view too.Layout that resize make the view ugly and unreadable.(I will capture image for you why I told this tomorrow.My friend at office have small screen mobile.)
It make me 3 days handle with this problem lol.

Last edited by tin (2016-04-06 15:27:37)

Offline

#18 2016-04-06 16:13:00

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: Android : Is there a way to stop the keyboard from resizing the view?

Hello,

Yes; we have a Container control in App Builder. I am now try with the Container control. We can put the inputs inside a container and play with the container "overflow". I will inform you about my tests.

Online

#19 2016-04-06 16:51:51

tin
Member
Registered: 2016-03-20
Posts: 161

Re: Android : Is there a way to stop the keyboard from resizing the view?

David wrote:

Hello,

Yes; we have a Container control in App Builder. I am now try with the Container control. We can put the inputs inside a container and play with the container "overflow". I will inform you about my tests.

Great I wait for inform.And will find another solution too.

Offline

#20 2016-04-06 17:32:36

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: Android : Is there a way to stop the keyboard from resizing the view?

Hello,

Update your AB copy tin. I add the new "InputsScroll" app sample that have a behaviour like you wanted. The point is to use a Container control. Inside that control we can place the Inputs (or other controls) we wanted. The Container have their CSS "overflow-x" set to "auto". The view's Show event is used to set the Container height at the start.

The application behaviour is like you wanted and, furthermore, we no need to be worry about the Inputs position: the system automatically place the right Input visible. So, even when I add the new Focus and Blur events to all the Inputs, Select, MultiSelect and Textarea controls, in fact we no need to use that events here.

Please tell me if you found useful this tin.

P.S. I test the "InputsScroll" sample here in my 4'' Android 4.4.2 and my 4.7'' Android 5.1.1.

Online

#21 2016-04-06 17:53:15

tin
Member
Registered: 2016-03-20
Posts: 161

Re: Android : Is there a way to stop the keyboard from resizing the view?

I test it,David.Perfectly!!.
I try to find the code that you told
"The Container have their CSS "overflow-x" set to "auto"" where the code you place it?
Anyway,It work perfectly.
About Mapnavigate sample that I sent to you.You can use it as your sample in your app. big_smile
The best thing of App builder is you can find a sample in program.
Not like a B4A,It have no sample come with.You need to find out by yourself.

Offline

#22 2016-04-06 17:56:38

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: Android : Is there a way to stop the keyboard from resizing the view?

Hello,

Glad to know tin! And thanks for your kindly words.

"The Container have their CSS "overflow-x" set to "auto"" where the code you place it?

You can use the "Inline CSS" app's option or an external CSS file or the control inspector, which is what I do this time:

akohIvA.png

Online

#23 2016-04-06 18:09:11

tin
Member
Registered: 2016-03-20
Posts: 161

Re: Android : Is there a way to stop the keyboard from resizing the view?

Wow it easier now thanks,David. big_smile

Offline

#24 2016-04-06 18:16:17

tin
Member
Registered: 2016-03-20
Posts: 161

Re: Android : Is there a way to stop the keyboard from resizing the view?

Did the "view" can overflow too?

Offline

#25 2016-04-06 18:19:58

David
Admin
From: Alcobendas, Madrid, Spain
Registered: 2015-04-21
Posts: 1,657
Website

Re: Android : Is there a way to stop the keyboard from resizing the view?

Hello,

tin wrote:

Did the "view" can overflow too?

Maybe... if we set their height in the same way than the Container. I did not try it however.

Online

Board footer

Powered by FluxBB


Copyright ©2018 DecSoft. All rights reserved.