+ 3
Any experienced Android Studio programmers here? I need your help!
Hi, I am writing a game in Android Studio. I have a class called GameView that extends the SurfaceView class and an invisible EditText at the bottom of the screen, used to get input whenever I need that during the game... The problem is that when I open the soft keyboard the EditText should move above the keyboard so you can see what you're typing. I have set the "windowSoftInputMode" to "adjustResize" and now both the SurfaceView (where I draw all the stuff in the game) and the EditText are pushed upwards.. In other games, only the EditText is being pushed upwards, while the game screen is in place! How do I do this?
14 Answers
+ 1
have you tried "adjustPan",
In any game which I have played till now doesn't include any system keyboard directly in the game play, may be you can create a manual button of alphabet...etc, in place of keyboard because in any case "adjustPan" or "adjustResize", they both will create space for keyboard in different manner but they will!
+ 1
I did not have access to my computer due to some traveling reasons. So, I can't do the experiment work...
In WhatsApp, the background of the chatting page doesn't go up but only the chatting conversation goes up, I have done this in one of my app a year before but due to lack of computer, I can't check the code...Sorry for that!
But, I will suggest you to experiment with "adjustPan" or "adjustNothing" and also by creating a new layout(Relative or Linear)...
One more thing, use windowSoftInputMode with java code instead of placing in Manifest.xml because sometimes it doesn't work!
+ 1
I did experiment with the windowSoftInput, but none of the options worked for me..
It's so hard when it comes to developing games in Android. There is nothing on google, you have to sort every problem yourself 😂
+ 1
ya true, Android Studio is not for game development in my opinion,
I have some sort of experience with unity and unreal engine, they have far better tools for developing games and community support!
they're not open source, if you want to use Android Studio for game development then try with libGDX, it will be a far better option...but I don't have any experience with libGDX. So, only know the basic things about it...
+ 1
Have you tried libGDX, it works with android studio and as far as I know it doesn't provide a different IDE, so give it a try may be your hard work with java will become handy for you!
0
idk
0
what type of game you are creating first tell me, may be I help you more!
0
Piyush Raj, sorry for the late reply.
I am writing a multiplayer game, turn-based game. I need text input in the game. I have my own buttons, text and all that stuff. But as long as the textfields and keyboard are considered, no other game developer creates his own. Every game uses the system keyboard with an EditText.
If you know the game Coin Master for example, Brawl Stars or Fun Run, you can notice that whenever you click a text box (or textfield) in the game, an edit text appears at the bottom of the screen and then it's pushed upwards by the keyboard, while the canvas stays in place.
0
Yeah maybe it's mostly uaed for apps but you have everything you need to make games.
I don't want to use engines to make games. It is always better to use your own code.
I have a ton of libraries in java and an engine is the last thing I need, but for these kind of problems there is not a single tutorial online.. Maybe because Android Studio is not that old I guess....
0
First of all, create a brand new engine! I guess that's what is left now 😂
0
Yeah, now I can see that... Damn I've done so much work in java. I can't just leave that and go learn how to use some engine from the start... 😶
Nvm, thank you for your help..
0
No I haven't. I watched some videos about it, it sounds good and I will give it a shot.
Thanks a lot.
0
You are Welcome! 😊
0
Yes....i am....