I had some problem with SplashScreen. I wanted to replace the background of this boot screen. But my picture is somewhat stretched out. And then what size do I need to do? And what about the size, for example, the application icon, the application logo (I will add authorization, for example, to the screen too). How can these sizes be obtained?

Thanks in advance.

    1 answer 1

    Android works on devices with different screen resolutions and pixel densities (yes, I discovered America). Currently, Android supports the following pixel density settings: ldpi, mdpi, hdpi, xhdpi, xxhdpi and xxxhdpi.

    The base is the density mdpi, when 1px = 1dp. The rest are multipliers:

    LDPI: Portrait: 200 X 320px MDPI: Portrait: 320 X 480px HDPI: Portrait: 480 X 800px XHDPI: Portrait: 720 X 1280px XXHDPI: Portrait: 960 X 1600px XXXHDPI: Portrait: 1440 x 2560px 

    You have to create several copies of your image under different screens and put them in the drawable folders with the necessary identifier (drawable-hdpi, etc.). The system itself will choose the right one depending on the screen of the device. You may have to set additional parameters for the layout, in which the picture will lie:

     android:src="@drawable/your_image" android:scaleType = "centerCrop" // вид масштабирования 

    As for the application icon, the android studio has built-in tools for generating icons (Image Asset), you can create it based on your picture. You can use third-party generators, for example this one . Such a generated icon can be used on the activity screen, and it will be adapted for different extensions.

    And in general, to use pictures on the whole screen is undesirable))

    Also keep in mind that too large images will have a bad effect on performance.

    Read more here .

    • Wildly sorry that I could only now see this post. I would like to clarify. I need to take the basic screen resolution and for them to calculate the size of the image of the very formula? Those. for one resolution you get 6 files of different sizes? And all the files will be the same name? - odosenok
    • one
      @odosenok No One picture for one resolution. Just create pictures of the right size and put them in the drawable folders you need. Android Studio before inserting a picture into the project asks which subfolder to put it in, there you will see the necessary HDPI type identifier, etc. - YungBlade
    • @YoungBlade, okay, I'll go the other way. I take a picture for 1080x1920 resolution. Accordingly, its size is also 1080x1920. Further I stick on "Image Asset" (in mipmap). It is automatically inserted in different sizes for different pixel densities (hdpi, mdpi, xdhpi, ...). For a resolution of 320x426, you just need to trim the existing one and add it again via Image Asset? - odosenok
    • one
      @odosenok no. In the mipmap are the application icons, the icon can not be so big. This size table is for background images - YungBlade 8:40
    • one
      @odosenok mine you separate the concept of pixel density from resolution. A resolution of 320 X 480px corresponds to the pixel density of MDPI. you insert a picture of this size into the drawable folder with the identifier mdpi, then insert a picture with a resolution of 480 X 800px in hdpi - YungBlade