Skip to content
This repository has been archived by the owner on Apr 6, 2022. It is now read-only.

Margin between text field and soft Keyboard #47

Open
ATHellboy opened this issue Aug 14, 2017 · 10 comments
Open

Margin between text field and soft Keyboard #47

ATHellboy opened this issue Aug 14, 2017 · 10 comments

Comments

@ATHellboy
Copy link

ATHellboy commented Aug 14, 2017

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
Copy link
Author

Anyone ?

@Hemaolle
Copy link

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
Copy link
Author

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
Copy link

Hemaolle commented Aug 24, 2017

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
Copy link

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
Copy link
Author

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
Copy link

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
Copy link
Author

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

@Hemaolle
Copy link

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
Copy link
Author

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants