android - 将图像插入条目或编辑器 [Xamarin.Forms]
问题描述
有什么方法可以将图像添加到Entry
或Editor
中Xamarin Forms
吗?
提前致谢!
干杯!
解决方案
<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
使用这个链接你可以知道如何做到这一点
推荐阅读
- javascript - className 没有通过这个函数添加到 HTML 元素中,为什么?
- intellij-idea - IntelliJ IDEA 设置中的关联有什么作用
- c# - 如何使这个字符串成为 JSON 对象?
- algorithm - 二叉树优化解决方案?
- python - 没有获得简单程序的输出,请帮助我
- html - 音乐在我的编码中不起作用。怎么了?
- arrays - 如何将发出数组的可观察对象转换为单独发出数组每个值的可观察对象?
- c# - UWP Gridview 固定项目位置
- python - python 优化 n-gram 的 count()
- angular - 如何从 Angular 9 中的变量添加 CSS 类名取决于布尔变量?