Created Splash screen for your application, implemented by example . It is required that the image be on the whole screen, considering that it is loaded into xml.
Since the implementation implies the use of a theme, the image is loaded in an xml file, as a result of which it is not possible to change its width and height freely.
Perhaps this issue can be solved by analogy with the icon: create several images with different resolutions, but here the question also arises, if you rely on: ldpi, hdpi and so on, then for the phone we can have a normal resolution image, and a small one for the tablet.
I read this manual , but I didn’t see a complete solution, because I didn’t understand how many resource folders I need to create in order to cover all screens, and in the end it will work out. Clarified question. How to make that the image loaded in xml, on any device displayed in full screen.
|
1 answer
Make your markup, under SplashScreen, set the necessary parameters that match your needs, stretch, crop, enlarge, align, etc. Use it when showing.
Here is an example that will set relative to the borders of the image:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center"> <ImageView android:id="@+id/imageView" android:layout_width="wrap_content" android:layout_height="wrap_content" android:adjustViewBounds="true" android:src="@drawable/ic_launcher"/> </LinearLayout>
As an option to prepare, the necessary image formats for different devices and fill it in the background, adjust the container itself to prevent distortion.
" + picture will be 100% fullscreen on any device
" - low quality possible on a high resolution device (this you should consider)
- This solves the problem, but then the essence of the Splash Screen itself is lost. If we create it as an Activity, and load the layout there, then there will be a pause until all this happens, and all this time a white screen will be shown. If we do this procedure through a theme, then the display is instantaneous, which is what is required, but there is such a painful issue with the image. - Vyacheslav Martynenko
- About the background, and how to make the image be 100% fullscrenn. Do you need it to cover the whole background? Anything else you need to customize? - Vyacheslav Martynenko
- Adapt the transition from the system (white background) to your SplashScrenn markup by changing it. as an option, put your same drawable - Shwarz Andrei
- And you can tell how this is done, but I did not find such a solution in Google. - Vyacheslav Martynenko
- oneHmm, I’ll have to try the animation version, thanks. - Vyacheslav Martynenko
|