Android系统。避免背景缩放缩放、背景、系统、Android

2023-09-04 05:28:18 作者:我酷所以撩妹

在我们的Andr​​oid应用程序的启动活动,我们使用的是与整个空间的背景图像的LinearLayout。

In a start activity of our android application we're using a linearlayout with an background image for whole space.

图片大小是小320x480 - 一样的设备分辨率,我们使用的测试

The image size is 320x480 - the same as device resolution, we're using for testing.

现在的问题是,对图像进行调整UND看起来不是很好。

The problem is, the image will be scaled und looks not so nice.

我试图用ImageView的代替,但我有黑边。

I tried to use imageview instead, but I've got black borders.

一些想法,如何避免结垢或如何得到适当大小的背景图像?!

Some ideas, how to avoid scaling or how to get the proper size for background image?!

感谢你在前进。

穆尔。

推荐答案

在创建RES /绘制一个background.xml文件,并使用下列内容:

Create a background.xml file in res/drawable and use the following:

<bitmap android:src="@drawable/mybackgroundimage" android:gravity="center" />

和使用background.xml作为您的LinearLayout的背景。

And use this background.xml as your LinearLayout's background.

 
精彩推荐