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.
我在我的应用程序中使用了一个图像,我希望它能够正确地适合所有设备,即使它们具有不同的分辨率。有什么办法可以根据屏幕大小调整图像大小?
是的,您可以,有两种替代方法可以做到这一点;
在您的 XML 中;
android:scaleType="fitXY"
在您的 Java 代码中;
yourImageView.setScaleType(ScaleType.FIT_XY);