我正在制作我的第一个应用程序,在那里我有照片我希望用户可以通过“缩放效果”使它们更大。
我一直在网上搜索它,我发现我必须使用可以自动执行此操作的webview。
但图像没有出现。我只能以文字的形式观看他的路线:“ file:///storage/sdcard0/postals/4249.jpg ”
如果我包含“file://”则无关紧要。
这是代码。我希望你们中的任何人都可以帮助我
“Ivpostal”是我的webview的名称。而“adrecafoto”是一个字符串,其中包含手机画面中的图像路径:
**uriruta=Uri.parse(adrecafoto);
Cursor c = getContentResolver().query(uriruta,null,null,null,null);
c.moveToNext();
String filePath = "";
String[] column = { MediaStore.Images.Media.DATA };
int columnIndex = c.getColumnIndex(column[0]);
if (c.moveToFirst()) {
filePath = c.getString(columnIndex);
}
c.close();
String rutafoto= "file://"+filePath;
ivpostal.loadData(rutafoto, "text/html","utf-8");**