Android系统。避免背景缩放 [英] Android. Avoid scaling of background

查看:310
本文介绍了Android系统。避免背景缩放的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我们的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.

这篇关于Android系统。避免背景缩放的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆