-1
所以我試圖調整使用android圖形位圖的圖像。代碼中沒有錯誤,但是當我構建項目時,它會拋出「System.NotSupportedException:不知道Android.Graphics.Bitmap」異常。Xamarin系統不知道有關Android.Graphics.Bitmap
我試圖勾選公共語言運行時異常並重建項目都沒有工作。
這裏是我的代碼
[Activity(MainLauncher = false, Theme = "@style/MyTheme")]
public class Duzenle_Activity : ActionBarActivity
{
public static ListView liw;
Intent intent = new Intent();
public Dialog dialog;
public static int toplam_hesap_tutucu;
public static Duzenle_Adapter adapt;
public static TextView toplam;
private BackgroundWorker bw = new BackgroundWorker();
public static int toplam_hesap = 0;
public List<Sepet> gecici_sepet;
List<Yemek_Liste> yemek_ = new List<Yemek_Liste>();
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.menu_duzenle);
var toolbar = FindViewById<Toolbar>(Resource.Id.toolbar);
SetSupportActionBar(toolbar);
SupportActionBar.Title = "Duzenle";
yemek_ = MainActivity.db.selectItem();
liw = FindViewById<ListView>(Resource.Id.listv_duzenle);
adapt = new Duzenle_Adapter(this, Resource.Layout.duzenle_model, yemek_,this);
liw.Adapter = adapt;
var toolbarBottom = FindViewById<Toolbar>(Resource.Id.toolbar_bottom_duzenle);
toolbarBottom.InflateMenu(Resource.Menu.ekle_action);
toolbarBottom.MenuItemClick += (sender, e) =>
{
if (e.Item.TitleFormatted.ToString() == "Ekle")
{
var transaction = FragmentManager.BeginTransaction();
var dialogFragment = new Dialog_Ekle(this);
dialogFragment.Show(transaction, "dialog_fragment");
}
};
}
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data)
{
base.OnActivityResult(requestCode, resultCode, data);
if (resultCode == Result.Ok)
{
Duzenle_Adapter adapter = ((Duzenle_Adapter)liw.Adapter);
Bitmap mBitmap = null;
mBitmap = Android.Provider.MediaStore.Images.Media.GetBitmap(ContentResolver, data.Data);
Bitmap originalImage = BitmapFactory.DecodeByteArray(mBitmap.ToArray<Byte>(), 0, mBitmap.ByteCount);
Bitmap resizedImage = Bitmap.CreateScaledBitmap(originalImage, 25, 25, false);
adapter.al_getir().adresler = resizedImage;
adapter.NotifyDataSetChanged();
Console.WriteLine("ADRES1" + " " + data.Data);
}
}
public void tikla()
{
var imageIntent = new Intent();
imageIntent.SetType("image/*");
imageIntent.SetAction(Intent.ActionGetContent);
StartActivityForResult(
Intent.CreateChooser(imageIntent, "Select photo"), 0);
}
}
而且我從畫廊的URI獲取圖像。
編輯:爲什麼當代碼沒有錯誤時拋出這個異常。其實很奇怪。它不能關於android.graphics庫嗎?
編輯2:我保存這些位圖到數據庫,然後在列表視圖中顯示它
Bitmap a = sepet[position].adres;
tut.img.SetImageBitmap(a);
請添加複製項目你的問題,所以你有更多的背景。 –
你是什麼意思複製項目 –
http://stackoverflow.com/help/mcve –