Actually the problem is the png file (the file itself is 1920 by 1080). I put it in the drawable folder. Registered background in xml layout. On the emulator, everything works fine. On the phone the background is white and the pictures are not visible. Markup example

<LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:background="@drawable/image" android:orientation="vertical"> 
  • Not enough information to reproduce the problem. How to ask questions here to get a helpful answer. - pavlofff
  • I do not quite understand what other details you can write. I will gladly add details, you just tell me what. - plesser
  • Show the size and try to reduce the image - Yuriy SPb
  • @Yuriy SPb added to the question - plesser

1 answer 1

Each application is allocated a certain amount of memory for images. In the new devices a little more, in the old smaller. Therefore, you should understand that testing your application on a real, preferably modern, device, and not on an emulator. On my test device Xperia M with Android version 6, the phone took the picture perfectly.

In normal cases, the picture is very desirable, for example, in the imageView object. You can also use android:scaleType="fitXY" this mode stretches / compresses the image to fit it to the container, or android:scaleType="fitCenter" for logos with no background. And how to work with imageView on the background can be easily searched on the Internet, in this case many ways are considered.

  <ImageView android:layout_height="match_parent" android:layout_width="match_parent" android:scaleType="fitXY" android:src="@drawable/ms"/> 

But the picture will not be full screen, and you need to find a way to make it full.

What do you have there - you need to look at the source, telepaths on vacation.

For example, adding android:background="@drawable/ms" in RelativeLayout picture on my phone was displayed easily.

enter image description here

  • Here is the picture I’m trying to cram yadi.sk/i/nCVt0-xF3ET6XP - plesser
  • and just background bad to use? - plesser
  • can. I did not say that, it is really better to apply the background than in imageView, but in general everything depends on the task. galvnoe to work. pp.vk.me/c637530/v637530232/2ed64/237OMN7Dj-s.jpg - Egor
  • For some reason, it's not displayed on my Samsung S5 with Android 6 .... - plesser
  • Try to play with the resolution and other pictures with the same parameters. This is all that I, and most likely others, will be able to advise you here. - Egor