首页 > 解决方案 > 将图像插入条目或编辑器 [Xamarin.Forms]

问题描述

有什么方法可以将图像添加到EntryEditorXamarin Forms吗?

提前致谢!

干杯!

标签: androidxamarin.formsxamarin.android

解决方案


<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 

使用这个链接你可以知道如何做到这一点


推荐阅读