My layout looks like this:
<LinearLayout>
<RelativeLayout>
Some Image and Text as Title
</RelativeLayout>
<RelativeLayout>
<LinearLayout>
<ListView>
My message List
</ListView>
</LinearLayout>
<RelativeLayout>
Edit Box and Send Button
</RelativeLayout>
</RelativeLayout>
</LinearLayout>
I explicitly set the current selection to the last item (newest) of the list when showing.
When not entering text in the Edit box at the bottom, the screen looks like this:
Top Title
List Item 8
List Item 7
...
List Item 2
List Item 1
Bottom Edit box and Send Button
When I click on the Edit box to type my message, the screen looks like this:
Top Title
List Item 8
...
List Item 5
Bottom Edit Box and Send Button
Keyboard
What I really want is:
Top Title
List Item 4
...
List Item 1
Bottom Edit Box and Send Button
Keyboard
Can someone help me please?
I found the answer here.
Basically just extend ListView with your custom class, override the onSizeChanged() method to setSelection(getCount());
This seems to be the best solution, and it appears Google Voice uses the same tactic (because if you're at the top of the chat list, then rotate the screen, it puts you back at the bottom).
Also remember that android:windowSoftInputMode="adjustResize" is present instead of adjustPan in your activity's tags in your manifest.
Did you try this?
You would need to use setTranscriptMode(ListView.TRANSCRIPT_MODE_NORMAL)
and setStackFromBottom(true)
in your list. Hope it helps, it worked for me!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With