我的 android 应用程序有一个背景,是一个 png 图像。它的大小为 800 x 480 像素。它在宽度上被拉伸,因此看起来不像我想要的那样。由于图像实际上是应用程序的背景,而不仅仅是一个 imageView,我无法使用 android:scaleType="centerCrop" 来使图像均匀缩放。
我需要图像来均匀地填充背景。
我也尝试过使用 NinePatch drawable,但结果并不好 - 图像变得模糊或在垂直拉伸时还可以,但不是宽度方向。
这是我的 XML 代码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:background="@drawable/menu"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical"
有没有其他命令可以让背景正确显示?