0
私は1つのリストビューを実装したxamarinアンドロイドアプリケーションを開発しています。だから私はそのイメージをlistviewに表示する必要があるので、pathを使ってimageviewにイメージを表示する方法です。DIsplay画像をローカルストレージからの画像ビュー
私は
internal class MyCustomListAdapter : BaseAdapter
{
private List<AlbumTable> albm;
private LayoutInflater mInflater;
Context c;
Dialog dialog;
public MyCustomListAdapter(Context c,List<AlbumTable> albm)
{
this.albm = albm;
this.c = c;
mInflater = (LayoutInflater)c.GetSystemService(Context.LayoutInflaterService);
}
public override int Count
{
get
{
return albm.Count();
}
}
public override Java.Lang.Object GetItem(int position)
{
return null;
}
public override long GetItemId(int position)
{
return long.Parse(albm[position].Id);
}
public override View GetView(int position, View view, ViewGroup parent)
{
Button btnDelete;
ViewHolder1 holder = null;
if (view == null)
{
view = mInflater.Inflate(Resource.Layout.inflate_album, null);
holder = new ViewHolder1();
holder.coverp = view.FindViewById<ImageView>(Resource.Id.sliderviewpager);
btnDelete = view.FindViewById<Button>(Resource.Id.share_album);
btnDelete.Focusable = false;
btnDelete.FocusableInTouchMode = false;
btnDelete.Clickable = true;
btnDelete.Click += (object sender, EventArgs e) =>
{
Android.App.AlertDialog.Builder alert = new Android.App.AlertDialog.Builder(c);
alert.SetTitle("Delete Album");
alert.SetMessage("Are you really wnt to delete the Album");
alert.SetCancelable(false);
alert.SetPositiveButton("Yes", delegate {
DatabaseHelper db = new DatabaseHelper();
bool aa=db.DeleteFromTable(albm[position]);
if (aa)
{
Toast.MakeText(c, "Album Deleted Successfully", ToastLength.Short).Show();
}
});
alert.SetNegativeButton("No", delegate {
if (dialog.IsShowing)
dialog.Dismiss();
});
dialog = alert.Create();
dialog.Show();
};
}
else
{
btnDelete = view.FindViewById<Button>(Resource.Id.share_album);
holder = view.Tag as ViewHolder1;
btnDelete.Tag = position;
}
return view;
}
ここxamarin.android
にファイルパスから画像を表示する方法を私のCustomAdaptorを取得していないですし、
class AlbumTable
{
[PrimaryKey]
public string Id { get; set; }
public string ZipFillPath { get; set; }
public string CoverPhotoPath { get; set; }
public string AlbumKey { get; set; }
public string NoOfPages { get; set; }
public string Email { get; set; }
public string LastName { get; set; }
public string FirstName { get; set; }
public string City { get; set; }
public string Address1 { get; set; }
public string ZipPostalCode { get; set; }
public string PhoneNumber { get; set; }
}
を次のように私のゲッターセッターメソッドがありますパスを使用してイメージビューにイメージを表示する方法。