在活动全屏幕的背景图像 [英] Full screen background image in an activity

查看:161
本文介绍了在活动全屏幕的背景图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看到,使用全屏图像作为背景多种应用。 这是一个例子:

I see many applications that use a full-screen image as background. This is an example:

我想用这个项目中,我发现,到目前为止,做到这一点是使用图像具有大尺寸,把它放在一个的ImageView 和使用安卓adjustViewBounds =真正的来调整页边距

I want to use this in a project, the best way I've found so far to do this is to use an image with a large size, put it in a ImageView and use android: adjustViewBounds="true" to adjust the margins

的问题是,如果具有非常高的分辨率的屏幕,所述图像属于短

The problem is that if a screen with a very high resolution, the image falls short.

我想到了另一种选择是使用图像中的的FrameLayout ,与 match_parent 宽度高度作为背景...这绵延的形象,但我觉得结果不是很好。

Another option I thought of is to use the image in a FrameLayout, with match_parent in width and height as background... this stretches the image, but I think the result is not very good.

我可以问你会怎么做呢?

I can ask how would you do it?

在此先感谢 Regrads

Thanks in advance Regrads

推荐答案

有几种方法可以做到这一点。

There are several ways you can do it.

选项1:

创建不同的完美的图像不同的DPI,并将其放置在相关的绘制文件夹。然后设置

Create different perfect images for different dpi and place them in related drawable folder. Then set

安卓背景=@可绘制/ your_image

选项2:

添加一个大的图像。使用的FrameLayout。作为第一个孩子添加的ImageView 。设置在你的ImageView以下。

Add a single large image. Use FrameLayout. As a first child add an ImageView. Set the following in your ImageView.

android:src="@drawable/your_image"
android:scaleType = "centerCrop"

这篇关于在活动全屏幕的背景图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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