如何在android studio中获得背景图像?

时间:2015-08-10 16:22:18

标签: android css xml

所以我试图导入一个自定义图像作为Android应用程序的背景,但它没有填充所有的边缘。我看到的选项是将第二个布局设置为帧布局,然后在其中放置一个图像视图,其中包含android:scaleType =“centerCrop”的附加编码。这不会为我填满整个屏幕,然而,这是最终发生的截图 -

enter image description here

下面是使用的xml代码:

If did't found any match it will insert new row
If found it will replace data if provide

另一个问题是不同的用户使用不同的分辨率,因此背景图像必须能够容纳它们而不会被切断。我不知道该怎么做。

1 个答案:

答案 0 :(得分:2)

设置ScaleType fitXY并添加android:adjustViewBounds ="true" 请使用android:src="@drawable/代替背景。我希望它会对您有所帮助。