Reputation: 151
The image I used for my splash screen with (gravity:center) doesn't fit my mobile screen, even if I changed gravity to fill.
<item>
<bitmap
android:gravity="fill"
android:src="@drawable/drawable"/>
</item>
Upvotes: 2
Views: 2274
Reputation: 874
Use FrameLayout as your Root
Put an ImageView in it and set ScaleType to fitXY
and set adjustViewBounds to true
So change your layout like below:
<FramLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
>
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="fitXY"
android:adjustViewBounds="true"
android:src="@drawable/bg_splash"
/>
</FrameLayout>
Upvotes: 0
Reputation: 21
use the bitmap in the XML file as a background
android:background="@drawable/bg_splash"
Upvotes: 0
Reputation: 1925
Normally I used common single image for all kind of devices, which size is 720px*1280px.
Then in my splash_activity.xml
i usually used it like following way:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:background="@drawable/bg_splash"
android:gravity="center"
android:orientation="vertical" />
Upvotes: 1