我试图在我的 android 项目中将背景图像放入 linearlayout。除了屏幕左右两侧的褪色边缘外,一切都很好。我的背景图像尺寸为 52x602,并且最初没有这样的渐变边缘。我希望背景图像覆盖所有区域。它也是由设计师完成的,我认为使用 9 补丁(图像周围有黑色边框)。如何在没有这些边缘的情况下正确设置背景?
在模拟器中它看起来像这样:
XML:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/login_background"
android:orientation="vertical"
>
</LinearLayout>
最佳答案
好的,我自己得到了答案。如果 .png 文件是 9-patch 文件,则它们必须以 .9.png 结尾......所以如果有人遇到同样的问题,那么你就会知道。
关于android - 具有褪色边缘的背景图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5525728/