我想聊天應用程序類型的用戶界面在我的應用程序&我的目標是Android和iOS。 我使用Xamarin.Forms.Editor在這種情況下回復如何應用最大高度並啓用滾動到Xamarin.Forms.Editor
Editor _replyEntry = new Editor
{
HorizontalOptions = LayoutOptions.FillAndExpand,
TextColor = Color.Black
}
編輯器的高度保持不變,並允許滾動和編輯器沒有擴展
然後我用InvalidateMeasure()
_replyEntry .TextChanged += (sender, e) => { this.InvalidateMeasure(); };
在這種情況下,編輯器擴展的時候,文本需要更多的空間,但不允許滾動內部編輯器,如果用戶鍵入長消息,然後編輯器不允許滾動和文本在鍵盤後面並且不可見用戶
有什麼辦法,使滾動並通過編寫定製的渲染
感謝
這裏舉最大高度的xamarin.forms編輯要麼是我的代碼
public class abc : ContentPage
{
public abc()
{
Image attchment = new Image
{
Source = "attachment.png",
HorizontalOptions = LayoutOptions.Start
};
Editor _replyEntry = new Editor
{
HorizontalOptions = LayoutOptions.FillAndExpand,
TextColor = Color.Black,
};
Button _sendButton = new Button
{
Text = "Send",
TextColor = Color.Black,
BackgroundColor = Color.Transparent,
HorizontalOptions = LayoutOptions.End
};
StackLayout replyStack = new StackLayout
{
Orientation = StackOrientation.Horizontal,
Padding = new Thickness(10),
Spacing = 10,
VerticalOptions = LayoutOptions.End,
Children = { attchment, _replyEntry, _sendButton }
};
Content = replyStack;
}
}
你可以發佈你的完整代碼,因爲它並不能完全說明你真正想要的東西。你在主持你的編輯? – Pete
這裏是我的代碼 –
你有沒有嘗試過這裏的建議 - https://forums.xamarin.com/discussion/38172/how-to-autosize-editor-height。它看起來像你將不得不寫一個自定義的渲染器,但要得到你想要的? – Pete