In the application I'm working on, we have a splash screen consisting of a RelativeLayout and a logo in the center (and some other things like a bootloader, etc.):
fragment_splash_image.xml:
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_centerInParent="true"
android:background="@drawable/loading_screen_bg"
... >
<ImageView
android:id="@+id/universal_loading_logo"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:src="@drawable/logo_large"
... />
... other stuff ...
</RelativeLayout>
To make sure that our popup screen was not just a brief blank screen, we have a SplashTheme in styles.xml for activity. His android:windowBackgroundis just a list of layers with the logo in the center again, with the hope that the logo will remain in the middle of the screen, while other things in the fragment_splash_image will also be displayed.
splash_placeholder.xml:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" android:opacity="opaque">
<item android:drawable="@drawable/loading_screen_gradient"/>
<item>
<bitmap
android:gravity="center"
android:src="@drawable/logo_large"/>
</item>
</layer-list>
, @drawable/logo_large - . , .
, fragment_splash_image , FrameLayout, :
private void inflateContent() {
final View splashImageFragment = LayoutInflater.from(getContext()).inflate(R.layout.fragment_splash_image, this, true);
final ImageView brandLogo = (ImageView) splashImageFragment.findViewById(R.id.universal_loading_logo);
final int statusBarHeight = ScreenUtils.getStatusBarHeight(getResources());
final int navBarHeight = !ScreenUtils.hasSoftNavBar() ? 0 : ScreenUtils.getNavigationBarHeight(getResources());
brandLogo.setPadding(0, 0, 0, statusBarHeight - navBarHeight);
}
, , . , , , . Galaxy S6 , , , - , . . Nexus 7, , . , , , , : bottom padding = statusBarHeight - navBarHeight, navBarHeight - 0 .
... Google Pixel. . Pixel, 0 .
. ? , , , . !