我試圖從路徑顯示圖像。如果我將圖像移動到可繪製的位置,我可以顯示圖像,但是我想從圖像路徑顯示圖像。我嘗試使用帶有GetImageBitmapFromUrl(「圖像路徑」)的imageBitMap,但它只顯示一個空白屏幕。借調的方式我想是Android.Net.Uri URL = Android.Net.Uri.Parse(下稱「映像路徑」)從xamarin的文件路徑顯示圖像
namespace SetPictureUrl
[Activity(Label = "SetPictureUrl", MainLauncher = true, Icon = "@drawable/icon")]
public class MainActivity : Activity
{
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
SetContentView(Resource.Layout.Main);`{
ImageView imagen = FindViewById<ImageView>(Resource.Id.demoImageView);
//------------------ i tried but did not work. the screen is blank
// var imageBitmap = GetImageBitmapFromUrl("my image path");
// imagen.SetImageBitmap(imageBitmap);
//---------------- i tried but did not work. the screen is blank
Android.Net.Uri url = Android.Net.Uri.Parse("./HTC Desire 620/Internal storage/storage/emulated/0/test/fox.jpeg");
imagen.SetImageURI(url);
//----- this work but is not the way i wish to do it. my main program work with file paths
// imagen.SetImageResource(Resource.Drawable.fox);
}
我打過電話,鑑於這樣的路徑,但似乎並沒有發揮作用 例如:
(./HTC慾望620 /內部存儲/存儲/模擬/ 0 /測試/ fox.jpeg)
,(HTC慾望620 /內部存儲/存儲/模擬/ 0 /測試/ fox.jpeg)
and(¬/ HTC Desire 620/Internal storage/storage/emulated/0/test/fox.jpeg)
但沒有喜悅。我會喜歡任何幫助。不確定爲什麼這給了我很多問題/
你從哪裏得到路徑? '/ HTC Desire 620 /內部存儲'不存在於任何手機上... – Cheesebaron
我顯示拍攝照片時獲得的路徑,並在手機上查看手機內存時查看。他們匹配 – oisin1min
不知道你如何檢查手機內存,但在這種情況下正確的路徑是:'/ storage/emulated/0/test/fox.jpeg' – Cheesebaron