Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
对于我的应用程序,我需要获取图像的高度和宽度。但是,当我尝试在 onCreate/onStart/onResume 方法中获取图像时,图像没有参数。在什么时候我可以获得图像的值/图像是否已加载?
提前致谢!:)
您需要使用ViewTreeObserverwith ViewTreeObserver.OnPreDrawListener。
ViewTreeObserver
ViewTreeObserver.OnPreDrawListener
有关更多详细信息,请查看此答案:如何获取 android.widget.ImageView 的宽度和高度?