Skip to content Skip to sidebar Skip to footer

How To Remove The White Border Around The Image In Splash Screen In Full Screen

I am currently working on a splash screen with an image view. The problem is that when the splash screen is shown, there is a white border around the image. So that the splash scre

Solution 1:

I apply a transparent background in the theme/style I use for my splash pages, this way I don't have to distort the image being displayed to fit the screen size of the device. This works particularly well when using PNG files that contain a transparent background.

Here's the style I use for this "Transparent" theme:

<stylename="Theme.Transparent"parent="android:Theme"><itemname="android:windowIsTranslucent">true</item><itemname="android:windowBackground">@android:color/transparent</item><itemname="android:windowContentOverlay">@null</item><itemname="android:windowNoTitle">true</item><itemname="android:windowIsFloating">true</item><itemname="android:backgroundDimEnabled">false</item></style>

You then apply this theme to the splash activity in your application manifest as follows:

<activityandroid:name="com.masseria.homework9.SplashActivity"android:configChanges="orientation|keyboardHidden|screenSize"android:label="@string/app_name"android:theme="@style/Theme.Transparent" ><intent-filter><actionandroid:name="android.intent.action.MAIN" /><categoryandroid:name="android.intent.category.LAUNCHER" /></intent-filter></activity>

Solution 2:

It seems to me like you could remove everything from your layout except for the ImageView. So it would look like this:

<ImageView xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/ImageViewSplash"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:adjustViewBounds="true"
        android:scaleType="centerCrop"
        android:contentDescription="@string/splashImageContentDescription" />

Then you could play around with the scaleType on the image until you found one that filled the screen. If none of that works, I would suggest increasing the resolution of your image file.

Post a Comment for "How To Remove The White Border Around The Image In Splash Screen In Full Screen"