如何去掉白边图像周围的闪屏全屏 [英] How to remove the white border around the image in splash screen in full screen
问题描述
我目前正在启动屏幕上用图像视图。问题是,显示启动画面时,有图像周围有白色边框。这样在启动画面显示与周围的白色边框的图像。我想彻底清除白色边框。有没有谁知道这个或任何建议?原因任何一个
下面是我的XML code:
<?XML版本=1.0编码=UTF-8&GT?;
<的RelativeLayout的xmlns:机器人=http://schemas.android.com/apk/res/android
机器人:layout_width =match_parent
机器人:layout_height =WRAP_CONTENT> <景观的android:layout_width =match_parent
机器人:layout_height =match_parent/> < ImageView的机器人:ID =@ + ID / ImageViewSplash
机器人:layout_width =match_parent
机器人:layout_height =match_parent
机器人:adjustViewBounds =真
机器人:scaleType =centerCrop
机器人:contentDescription =@字符串/ splashImageContentDescription/>
< / RelativeLayout的>
我申请在主题/风格我用我的形象页面透明背景,这样我就不必扭曲的形象显示,以适应该装置的屏幕尺寸。使用含有透明背景的PNG文件时,此效果尤其好。
下面是我用这个透明的主题风格:
<样式名称=Theme.Transparent父=安卓主题>
<项目名称=机器人:windowIsTranslucent>真< /项目>
<项目名称=机器人:windowBackground> @android:彩色/透明< /项目>
<项目名称=机器人:windowContentOverlay> @空< /项目>
<项目名称=机器人:windowNoTitle>真< /项目>
<项目名称=机器人:windowIsFloating>真< /项目>
<项目名称=机器人:backgroundDimEnabled>假LT; /项目>
< /风格>
您再申请这个主题溅活动应用程序清单如下:
<活动
机器人:名字=com.masseria.homework9.SplashActivity
机器人:configChanges =方向| keyboardHidden |屏幕尺寸
机器人:标签=@字符串/ APP_NAME
机器人:主题=@风格/ Theme.Transparent>
&所述;意图滤光器>
<作用机器人:名字=android.intent.action.MAIN/> <类机器人:名字=android.intent.category.LAUNCHER/>
&所述; /意图滤光器>
< /活性GT;
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 screen shows the image with the white border around. I would like to remove the white border completely. Is there any one who know the reason for this or any suggestion?
Here is my xml code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content" >
<View android:layout_width="match_parent"
android:layout_height="match_parent" />
<ImageView android:id="@+id/ImageViewSplash"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:contentDescription="@string/splashImageContentDescription" />
</RelativeLayout>
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:
<style name="Theme.Transparent" parent="android:Theme">
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowIsFloating">true</item>
<item name="android:backgroundDimEnabled">false</item>
</style>
You then apply this theme to the splash activity in your application manifest as follows:
<activity
android:name="com.masseria.homework9.SplashActivity"
android:configChanges="orientation|keyboardHidden|screenSize"
android:label="@string/app_name"
android:theme="@style/Theme.Transparent" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
这篇关于如何去掉白边图像周围的闪屏全屏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!