'How to prevent a splash screen image from stretching
I am creating a game.
At the moment, for my splash screen, I use an image.
The problem is it stretches.
How do I prevent that?
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="@dimen/activity_vertical_margin"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
tools:context="hitesh.asimplegame.SplashScrean"
android:background="@drawable/mulalo">
Solution 1:[1]
Always use Imageview for displaying the image.
Sample xml for splash screen
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/splash_bg"
android:scaleType="centerCrop"
/>
</RelativeLayout>
Replace your image with splash_bg.
NOTE : As question with less information I am assuming that you are using only one image for the splash screen.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Shabbir Dhangot |