[英]How to Resize background image to match the Layout?
我有一个问题,如何在 android studio 中调整背景图像的大小以匹配整个布局,例如:我有一个默认为横向的可绘制对象,但我的布局是水平的,我想减小宽度并增加高度thag 照片以匹配 thr 布局,我该怎么做?
您需要缩放图像,添加此属性并将 fitCenter 更改为与您的条件android:scaleType="fitCenter"
对应的值。
There are android scale types which you can refer CENTER, CENTER_CROP, CENTER_INSIDE, FIT_CENTER, FIT_END, FIT_START, FIT_XY and MATRIX.您可以参考CENTER、CENTER_CROP、CENTER_INSIDE、FIT_CENTER、FIT_END、FIT_START、FIT_XY 和 MATRIX 的 android 比例类型。 which can be used as per your requirement.
可以根据您的要求使用。 But as you mentioned you can try
android:scaleType="center_crop"
which crops the image a bit but covers the whole screen但正如您提到的,您可以尝试
android:scaleType="center_crop"
图像但覆盖整个屏幕
This Should do the trick这应该可以解决问题
android:scaleType="fitXY"
android:adjustViewBounds="true"
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.