我在我的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"
是否有任何其他命令,我可以用它來得到正確顯示的背景?
用黑色填充您的背景,並將您的標誌放在中心作爲圖像。 –