![](/img/trans.png)
[英]How to pick image from camera and gallery , crop it and set to image view
[英]How to crop the screen visible portion of an image from image view and store it?
我想獲得圖像視圖中在屏幕上可見的圖像部分。 就像在圖像視圖上放大了圖像一樣,應該裁剪並存儲屏幕上可見的放大部分。
我無法將庫或相機意圖用於該任務
。 所有操作都必須在同一頁面上完成。 考慮我在位圖/圖像視圖/資源文件中有圖像。
使用這些行來解決問題
Bitmap result = Bitmap.createBitmap(yourImageView.getWidth(),
yourImageView.getHeight(), Bitmap.Config.RGB_565);
Canvas c = new Canvas(result);
yourImageView.draw(c);
這4行代碼將為您提供在位圖結果中在屏幕上確切顯示的內容。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.