我在XF中使用带有Android平台自定义背景的条目。当它聚焦时,键盘覆盖了底线。
public class MessageEntryRenderer : EntryRenderer
{
protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
{
base.OnElementChanged(e);
if (e.OldElement != null || this.Element == null)
return;
Control.Gravity = DefaultGravity;
var MessageEntry = Element as MessageEntry;
UpdateBackground(MessageEntry);
...
}
private void UpdateBackground(MessageEntry MessageEntry)
{
if (_renderer != null)
{
_renderer.Dispose();
_renderer = null;
}
_renderer = new BorderRenderer();
//Set to background object of type GradientDrawable
Control.SetBackground(_renderer.GetBorderBackground(MessageEntry.BorderColor, MessageEntry.BackgroundColor, MessageEntry.BorderWidth, MessageEntry.BorderRadius));
} }
图片:
Entry with borders
Keyboard covers bottom
我需要显示底线。我试着像这样添加填充:
private void UpdatePadding(MessageEntry MessageEntry)
{ Control.SetPadding((int)Forms.Context.ToPixels(MessageEntry.LeftPadding), 10,
(int)Forms.Context.ToPixels(MessageEntry.RightPadding), 0);
但它是填入文本内部的文本。
}
答案 0 :(得分:0)
我修好了。 问题在于填充入口。底部和顶部为0。我按照以下代码设置它:
irb(main):003:0> [1,2,3].reverse_rek
=> [3, 2, 1]
irb(main):004:0> [1,[2.0,2.1,2.3],3].reverse_rek
=> [3, [2.3, 2.1, 2.0], 1]
irb(main):005:0> [1,[2.0,2.1,2.3],['a','b','c'],3].reverse_rek
=> [3, ["c", "b", "a"], [2.3, 2.1, 2.0], 1]