约束布局中的背景图片不起作用 [英] Background image in constraints layout does not work

查看:73
本文介绍了约束布局中的背景图片不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望我的应用在后台使用图像进行注册和登录功能.我正在使用android studio 2.3,到目前为止,我可以看到自去年以来很多事情发生了变化.现在我们使用相对布局或线性布局的地方就是约束布局.我以根布局包括了一个代码:

I want my app to use a image in the background for signup and signin function. I am using android studio 2.3 and so far I can see that lot many things have changed since last year. Where we used relative or linearlayout now that is constraint layout. I included a code with the root layout as:

android:background="@drawable/wallpaper_2"
    android:orientation="vertical"

查看此图像以获取更多信息:

Check this image for more information:

当我在Nexus 5上测试该应用时,它不会仅显示空白屏幕,而是会在预览屏幕上显示相同的图像.任何帮助将不胜感激.

When I test this app on my Nexus 5 it does not show anything just a blank screen but the it shows the same image on the preview screen. Any help would be appreciated on this.

推荐答案

对于设备将图片调整为较小的尺寸,然后将图片放到特定的可绘制文件夹中.例如:如果图像尺寸为 1280 x 720 ,则将图像放置在drawable-xxhdpi文件夹中.

The resolution of your image is too large for the device resize your picture to smaller dimesions and based on that put your image into specific drawable folder. e.g : If image size is 1280 x 720 than put image in drawable-xxhdpi folder.

这篇关于约束布局中的背景图片不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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