如何缩放像android这样的位图:scaleType =“fitCenter”?
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="@drawable/gradient"/>
<item android:bottom="60dip">
<bitmap
android:gravity="center_horizontal|bottom"
android:src="@drawable/image"/>
</item>
</layer-list>
我有680x120像素的图像,图像不适合小屏幕 . 我一直在尝试重力,但它没有帮助我(例如,我看到图像240x120,但不是240x42) . 我将此样式用于活动背景,我不能使用ImageView .
2 回答
如果您不使用 < LinearLayout > ,请尝试将其与您的方法一起使用 .
同样的问题在这里,但我用重力填充水平解决这个问题,第二个最重要的是你必须使用方形图像/ png像240p X 240p然后图片将自动调整大小到其屏幕 .