如何处理用户记录,使其长度与按钮匹配?
CustomEntryUnderlineRenderer.cs
OnElementChanged(ElementChangedEventArgs<Entry> e)
{
base.OnElementChanged(e);
if (Control == null || e.NewElement == null)
return;
Control.BorderStyle = UITextBorderStyle.None;
CALayer line = new CALayer
{
Frame = new CGRect(0, Frame.Height, Frame.Width, 1f)
};
Control.Layer.AddSublayer(line);
}
Page.xaml
<StackLayout Margin="20,0">
<Label Text="The address of your server:" FontSize="Small" FontFamily="{StaticResource RalewayNormal}" TextColor="White" HorizontalOptions="FillAndExpand"/>
<local:CustomEntryUnderline x:Name="addressEntry" Margin="0,15,0,0" FontSize="Small" Text="http://192.168.0.217/PelicanMobile" Placeholder="Enter the server address" FontFamily="{StaticResource RalewayNormal}" TextColor="White" PlaceholderColor="White"/>
<Button x:Name="btnAdressEnter" Text="Enter" BorderRadius="0" Clicked="OnButtonClicked_Enter" FontSize="Small" FontFamily="{StaticResource RalewayNormal}" TextColor="White" BackgroundColor="#E67E20"/>
</StackLayout>