是否可以将图像添加到Entry
中的Editor
或Xamarin Forms
中?
谢谢!
干杯!
答案 0 :(得分:0)
<Grid Grid.Row="3" Padding="0,10,0,0">
<local:MyFrame BackgroundColor="Transparent" OutlineColor="White" HasShadow="false" Padding="20,5,5,5">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image Source="Username.png" HeightRequest="20" WidthRequest="20" HorizontalOptions="Start" />
<local:MyEntry Placeholder="UserName / PhoneNo" x:Name="Entry" BackgroundColor="Transparent" PlaceholderColor="White" Grid.Column="1" HorizontalOptions="FillAndExpand" TextColor="White" FontSize="15" HeightRequest="40" />
</Grid>
</local:MyFrame>
通过这种方式,您可以在输入字段的前面添加图像。如果需要,请放在EntryField
顶部。您可以为输入和图像设置相同的网格位置。然后设置相应的高度和宽度请求。
https://forums.xamarin.com/discussion/99140/how-to-place-icon-before-entry-control
使用此链接,您可以了解如何操作
答案 1 :(得分:0)
如果您只想在Entry控件中插入图像,则可以创建自定义条目,请看一下这篇文章:
https://xamgirl.com/image-entry-in-xamarin-forms/
如果您想在Entry中添加表情符号并删除它,建议您将Keyboard = chat设置为Entry:
<Entry Keyboard="Chat" />
https://docs.microsoft.com/en-us/xamarin/xamarin-forms/user-interface/text/entry
答案 2 :(得分:0)
PhantomLib库具有一个入口控件,该控件使您可以拥有一个图标,当用户点击输入的文本时,该图标将清除输入的文本。它还具有显示/隐藏密码文本的图标的功能。您可以通过nuget直接使用它,也可以查看源代码并进行修改。 https://github.com/OSTUSA/PhantomLib