YousicianGit / UnityNativeEdit

Unity Native Input Plugin for both iOS and Android (Unity UI compatible)
44 stars 13 forks source link

Margin between text field and soft Keyboard #47

Open ATHellboy opened 7 years ago

ATHellboy commented 7 years ago

I test many things but I've not found any solution.

Actually I want set margin between text field and soft keyboard but I've not found any solution.

The current situation is this :

screenshot_2017-08-14-16-28-48

As you see, keyboard covers part of text field background.

I've found the solution that use scrollrect of android and group layouts but I think we can do it in Unity.

Then I try to handle it in Unity not Android native but there is no success. I can't find out keyboard is visible or not because TouchScreenKeyboard.visible don't return correct value and it is because of handling keyboard by plugin. So after that I try to find keyboard visibility by Android native codes but there is no success again.

Do you have any solution ? I appreciate if you are.

Many thanks

ATHellboy commented 7 years ago

Anyone ?

Hemaolle commented 7 years ago

How about just positioning the text field higher?

The empty space above the keyboard in the screenshot looks like the area where the word suggestions would appear. It could be possible to disable that with some settings in the native code.

ATHellboy commented 7 years ago

Actually I put text field bottom of screen and when soft keyboard is opened, It's positioned like this. So changing position of text field doesn't solve any problem.

Maybe, I try to disable it but I don't think so because keyboard is positioned exactly under the text area.

Do you have any idea how we can group each part of UI in native ScrollView of android ? because I saw that some people say that move scrollView

Hemaolle commented 7 years ago

Perhaps Googling will help with the native ScrollView stuff, I'm not very familiar with native Android development.

I'm not quite sure about what it is you're trying to do. Do you want to anchor the text field to the keyboard so that it would be X pixels above the keyboard no matter what?

Hemaolle commented 7 years ago

If that is the case, perhaps you could use this stuff to check the keyboard height in Unity and try to reposition the input field based on that: https://forum.unity3d.com/threads/keyboard-height.291038/.

ATHellboy commented 7 years ago

I've googled it so much. I try many solutions but all of don't return correct value. each one because of some constraints.

Yup, Actually anchor the text field to keyboard and X pixel space above it.

Thanks, I'll check that.

Hemaolle commented 7 years ago

Now I understand what is happening here, so the input field is positioned in the bottom of the screen and when it's activated it's moved up so that it wouldn't be covered by the keyboard, but not enough, it's still partially covered by the keyboard.

I'm not sure how the input field is moved, I wasn't aware that this was happening.

I think we mostly built the menus where the native input field was used so that the input field was already positioned on the top of the screen so that it wouldn' be covered by the keyboard. That's probably the easiest workaround for this, but of course it's not that nice :(

ATHellboy commented 7 years ago

Actually I want to put text field bottom of screen like messenger applications on mobile devices.

Hemaolle commented 7 years ago

I think you might actually be able to control the keyboard distance from the textfield by changing the padding set here: https://github.com/YousicianGit/UnityNativeEdit/blob/master/src/androidProj/nativeeditplugin/src/main/java/com/bkmin/android/EditBox.java#L224.

ATHellboy commented 7 years ago

Yup, I've test it before but by padding text has distance from text background too. Maybe I need make distance between text and text background too.