![](/img/trans.png)
[英]how to get the name of a selected image from gallery of images android studio
[英]How to get width and height of image in gallery android studio?
我在sdcard中有圖片,即png樣本大小為701 x 438。 在放入ImageView
之前,我想在我的應用程序中檢索的大小。
如何在Java代碼中獲得此圖像的實際大小?
我的意思是圖像的實際寬度和高度。
您還可以使用BitmapRegionDecoder
以Bitmap的形式獲取圖像的實際高度和寬度。
BitmapRegionDecoder bitmapRegionDecoder = newInstance( pathName, isShareable);
從文件路徑創建BitmapRegionDecoder
。
使用以下方法獲取高度和寬度:
int getHeight()
返回原始圖像的高度
int getWidth()
返回原始圖像的寬度
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.