Open FrancoisM opened 8 years ago
@FrancoisM just use this plugin, it will solve the issue: https://www.nuget.org/packages/Xam.Plugins.Forms.KeyboardOverlap/
Tks but as you can imagine after 8 months I already implemented a solution ;-)
It might help others
@FrancoisM What was the solution you implemented? I've tried the plugin but has some mixed results.
@mjrichards91 Add the Entry at the End of a vertical StackLayout which itself goes into a ScrollView.
@FrancoisM So you put the ListView and the StackLayout/Entry within the ScrollView?
Here is some pseudo code. I forgot the details of why I had to do so but I use an absolutelayout whose height varies. Don't forget to put your send button somewhere lol. I actually also use an editor rather than an entry which I invalidate on TextChanged so it can grow in size when entering more text.
var scroll= new ScrollView
{
Content = new StackLayout
{
Children = {
new BoxView { VerticalOptions = Start, HeightRequest = listHeight}, //some fake space
new Entry { VerticalOptions = End }
}
}
}
var abs = new AbsoluteLayout();
var list = new Listiew();
abs.Chidren.Add(scroll);
abs.Children.Add(list, new Rectangle(0, 0, someWidth, listHeight));
scrollView.PropertyChanged += (s, e) =>
{
if (e.PropertyName != ScrollView.ScrollYProperty.PropertyName) return;
var initialHeight = listHeight;
var scrollHeight = scrollView.ScrollY;
var newHeight = initialHeight - scrollHeight;{newHeight}");
AbsoluteLayout.SetLayoutBounds(list, new Rectangle(messagesList.X, messagesList.Y, messagesList.Width, newHeight));
list.ScrollToBottom(false);
};
Content =abs;
The entry doesn't scroll up when the keyboard appears (at least on ios simulator). I guess the view should be within a sroll view.