Android Question IME: How do i acheive this??

Reminisce

Active Member
IME:
Sub IME_HeightChanged(NewHeight As Int, OldHeight As Int)
    txtfeedcomments.Top = pnlfeedcomments.Top - txtfeedcomments.Top
End Sub

Attached is a simple illustration of what I want, Can someone please help me with the proper IME code to achieve this? I don't understand the IME "Oldheight" and "New height"
parameters.
 

aeric

Expert
Licensed User
Longtime User
If you want the panel to move up then set the top value of the panel instead of the edittext.
Eg.
B4X:
pnlFeedComments.Top = -300dip
 
Upvote 0

JohnC

Expert
Licensed User
Longtime User
I don't understand the IME "Oldheight" and "New height"parameters.

The old height is the height of the viewable screen size BEFORE the screen size changed (like before the keyboard was displayed), and the new height is the new height of the visible screen AFTER the screen size changed.

For example, if the keyboard is NOT showing on the screen, then lets say the VERTICAL screen size is 1000 pixels. Then you do something to cause the keyboard to display (like bring focus to a editbox). When the keyboard is showing on the screen the available VERTICAL screen size is now smaller because the keyboard is now taking up space at the bottom of the screen.

So for this example, when the Keyboard IS DISPLAYED, the IME_HeightChanged could return something like "OldHeight=1000" and "NEWHeight=600". And then when the keyboard is NOT displayed, the values would be reversed ("OldHeight=600" and "NEWHeight=1000")

So basically, you would probably adjust the .Height of your panel (to make it shorter so the keyboard wont cover up the bottom part of it), instead of adjusting the .Top property.
 
Last edited:
Upvote 0

Peter Simpson

Expert
Licensed User
Longtime User
@Reminisce how far up do you want pnlfeedcomment to move up by???
When you tap on the edittext box, the edittext will automatically move up to above the keyboard. Sorry but I'm having a problem figuring out exactly what you are after. Why do you need IME if you are not manually calling the keyboard to display???

BTA you can easily move the red panel right to the top of the screen, read both the comments above...
 

Attachments

  • Ex1.zip
    9 KB · Views: 167
Upvote 0

Reminisce

Active Member
If you want the panel to move up then set the top value of the panel instead of the edittext.
Eg.
B4X:
pnlFeedComments.Top = -300dip


Thanks, this did not work

Edit: it worked, I forgot to add the "IME.ADDHEIGHTCHANGED" to my activity_firstime.

How do I return it back after the edittext has lost focus? And how do I make sure this particular panel is raised when a particular edittext has Focus?
 
Last edited:
Upvote 0

Reminisce

Active Member
Wow! Genius! Well laid out explanation.☺
 
Upvote 0

Reminisce

Active Member
I just want the panel to stay ontop the keyboard so the edittext and sendpost button will be visible.

Edit: The Panel should only move when a particular editext has focus.
In my case the "txtfeedcomments", not just any edittext. How do I achieve this?
 
Upvote 0

aeric

Expert
Licensed User
Longtime User
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…