我该如何压缩照片? [英] How do I can compress the photo?

查看:91
本文介绍了我该如何压缩照片?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建了一个社交网络应用 https://github.com/dingdangmao123/weico 我想压缩照片,所以我需要获得ImageView的宽度和高度,但是getwidth()和getHeight()是0.我该怎么办?



我尝试了什么:



我将固定值设置为150

I create a social networking app https://github.com/dingdangmao123/weico I want to compress the photo, so I need to get the width and height of ImageView,but getwidth() and getHeight() is 0. What should I do ?

What I have tried:

I set the fixed value like 150

推荐答案

使用调试器查看在你的代码运行时直接在ImageView上 - 我猜它不是你认为的那个,它根本不包含任何图像。

但我没有涉水通过你的整个项目试图找出你正在做什么的代码 - 如果你想要特定的答案,你需要显示相关的代码片段,而不是将代码转储给我们并说我不能帮助你,所以你帮助我了。



你的问题越好 - 也就是你付出的努力越多 - 我们的回答就越好可以。但只是倾销代码并期望我们趟过它只是粗鲁而且不会让你成为任何朋友......
Use the debugger to look at the ImageView directly while your code is running - I'm guessing it isn't the one you think it is, and it doesn't contain any image at all.
But I'm not wading through your entire project trying to work out where in that code you are doing what - if you want specific answers, you need to show relevant code fragments instead of dumping your code on us and saying "I can't be bothered to help you, so you help me instead."

The better your question - i.e. the more effort you put into it - the better our answers can be. But just dumping code and expecting us to wade through it is just rude and that doesn't make you any friends...


这篇关于我该如何压缩照片?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆