C# 如何在xamarin android中实现图像加载?(本机代码)
我是xamarin android的初学者。 我想在XamarinAndroid中显示一组类似FlowListview的图像。 我在axml中使用了以下代码。我使用了此链接。 但它不像flowlistview那样绑定图像C# 如何在xamarin android中实现图像加载?(本机代码),c#,xamarin.android,C#,Xamarin.android,我是xamarin android的初学者。 我想在XamarinAndroid中显示一组类似FlowListview的图像。 我在axml中使用了以下代码。我使用了此链接。 但它不像flowlistview那样绑定图像 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="ma
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:minWidth="25px"
android:minHeight="25px" >
<FFImageLoading.Views.ImageViewAsync
android:id="@+id/imgDisplay"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:scaleType="fitCenter" />
</LinearLayout>
这是我的c代码
公共类流列表活动:活动
{
ImageViewAsync imgThunbailUsername;
创建时受保护的覆盖无效(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.FlowListLayout);
setUserImage();
}
私有void setUserImage()
{
ImageService.Instance.Initialize();
imgThunbailUsername=findviewbyd(Resource.Id.imgDisplay);
字符串url=@“https://lh4.googleusercontent.com/-Lfgi-xEMwuk/VNWoy8EDWcI/AAAAAAAAACk/rwsluNfhSZY/w1486-h832-no/photo.jpg";
对于(int i=0;iIs)正确,您当前正在使用图像显示一个imageview?并且您希望使用此图像显示具有多个imageview的网格?图像来自一个列表。因此图像的数量是不可预测的。当然-但目前,您似乎没有使用“ListView”或“RecyclerView”要显示任何列表,表示项目列表?您使用的是listview还是recycler?您可以分享代码吗..我是初学者。对此我没有太多的想法。
public class FlowListActivity : Activity
{
ImageViewAsync imgThunbailUsername;
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
SetContentView(Resource.Layout.FlowListLayout);
setUserImage();
}
private void setUserImage()
{
ImageService.Instance.Initialize();
imgThunbailUsername = FindViewById<ImageViewAsync>(Resource.Id.imgDisplay);
string url = @"https://lh4.googleusercontent.com/-Lfgi-xEMwuk/VNWoy8EDWcI/AAAAAAAAACk/rwsluNfhSZY/w1486-h832-no/photo.jpg";
for(int i=0;i<3;i++)
{
ImageService.Instance.LoadUrl(url)
.Retry(3, 200)
.DownSample(60, 60)
.Into(imgThunbailUsername);
}
// compiler points here with an exception
}
}