这个问题在很多手机上看不到,在一款三星的手机(手机型号记不住了..)上遇到过,这里记录下解决方法
通常定义一个对话框都会修改其Style,如下,但这样在那一部三星的手机上顶部会有一条蓝色的线)
<style name="BottomDialog" parent="AlertDialog.AppCompat">
<item name="android:windowIsFloating">true</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowContentOverlay">@null</item>
</style>
后来看Style默认的源码,添加了几个属性解决了,修改后如下
<style name="BottomDialog" parent="AlertDialog.AppCompat">
<item name="android:windowIsFloating">true</item>
<item name="android:windowFrame">@null</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:backgroundDimEnabled">true</item>
<item name="android:windowContentOverlay">@null</item>
<item name="android:fullBright">@color/transparent</item>
<item name="android:fullDark">@color/transparent</item>
<item name="android:topBright">@color/transparent</item>
<item name="android:topDark">@color/transparent</item>
<item name="android:borderlessButtonStyle">@color/transparent</item>
</style>
最后贴下Style的属性大全,源地址
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (C) 2006 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!--
===============================================================
PLEASE READ
===============================================================
The Holo themes must not be modified in order to pass CTS.
Many related themes and styles depend on other values defined in this file.
If you would like to provide custom themes and styles for your device,
please see styles_device_defaults.xml.
===============================================================
PLEASE READ
===============================================================
-->
<resources>
<!-- Global Theme Styles -->
<eat-comment />
<style name="WindowTitleBackground">
<item name="background">@drawable/title_bar</item>
</style>
<style name="WindowTitle">
<item name="singleLine">true</item>
<item name="textAppearance">@style/TextAppearance.WindowTitle</item>
<item name="shadowColor">#BB000000</item>
<item name="shadowRadius">2.75</item>
</style>
<style name="DialogWindowTitleBackground">
<item name="background">@drawable/title_bar</item>
</style>
<style name="DialogWindowTitle">
<item name="maxLines">1</item>
<item name="scrollHorizontally">true</item>
<item name="textAppearance">@style/TextAppearance.DialogWindowTitle</item>
</style>
<style name="AlertDialog">
<item name="fullDark">@drawable/popup_full_dark</item>
<item name="topDark">@drawable/popup_top_dark</item>
<item name="centerDark">@drawable/popup_center_dark</item>
<item name="bottomDark">@drawable/popup_bottom_dark</item>
<item name="fullBright">@drawable/popup_full_bright</item>
<item name="topBright">@drawable/popup_top_bright</item>
<item name="centerBright">@drawable/popup_center_bright</item>
<item name="bottomBright">@drawable/popup_bottom_bright</item>
<item name="bottomMedium">@drawable/popup_bottom_medium</item>
<item name="centerMedium">@drawable/popup_center_medium</item>
<item name="progressLayout">@layout/progress_dialog</item>
<item name="horizontalProgressLayout">@layout/alert_dialog_progress</item>
<item name="needsDefaultBackgrounds">false</item>
</style>
<style name="Widget.PreferenceFrameLayout">
<item name="borderTop">0dip</item>
<item name="borderBottom">0dip</item>
<item name="borderLeft">0dip</item>
<item name="borderRight">0dip</item>
</style>
<!-- Base style for animations. This style specifies no animations. -->
<style name="Animation" />
<!-- Standard animations for a full-screen window or activity. -->
<style name="Animation.Activity">
<item name="activityOpenEnterAnimation">@anim/activity_open_enter</item>
<item name="activityOpenExitAnimation">@anim/activity_open_exit</item>
<item name="activityCloseEnterAnimation">@anim/activity_close_enter</item>
<item name="activityCloseExitAnimation">@anim/activity_close_exit</item>
<item name="taskOpenEnterAnimation">@anim/task_open_enter</item>
<item name="taskOpenExitAnimation">@anim/task_open_exit</item>
<item name="launchTaskBehindTargetAnimation">@anim/launch_task_behind_target</item>
<item name="launchTaskBehindSourceAnimation">@anim/launch_task_behind_source</item>
<item name="taskCloseEnterAnimation">@anim/task_close_enter</item>
<item name="taskCloseExitAnimation">@anim/task_close_exit</item>
<item name="taskToFrontEnterAnimation">@anim/task_open_enter</item>
<item name="taskToFrontExitAnimation">@anim/task_open_exit</item>
<item name="taskToBackEnterAnimation">@anim/task_close_enter</item>
<item name="taskToBackExitAnimation">@anim/task_close_exit</item>
<item name="wallpaperOpenEnterAnimation">@anim/wallpaper_open_enter</item>
<item name="wallpaperOpenExitAnimation">@anim/wallpaper_open_exit</item>
<item name="wallpaperCloseEnterAnimation">@anim/wallpaper_close_enter</item>
<item name="wallpaperCloseExitAnimation">@anim/wallpaper_close_exit</item>
<item name="wallpaperIntraOpenEnterAnimation">@anim/wallpaper_intra_open_enter</item>
<item name="wallpaperIntraOpenExitAnimation">@anim/wallpaper_intra_open_exit</item>
<item name="wallpaperIntraCloseEnterAnimation">@anim/wallpaper_intra_close_enter</item>
<item name="wallpaperIntraCloseExitAnimation">@anim/wallpaper_intra_close_exit</item>
<item name="fragmentOpenEnterAnimation">@animator/fragment_open_enter</item>
<item name="fragmentOpenExitAnimation">@animator/fragment_open_exit</item>
<item name="fragmentCloseEnterAnimation">@animator/fragment_close_enter</item>
<item name="fragmentCloseExitAnimation">@animator/fragment_close_exit</item>
<item name="fragmentFadeEnterAnimation">@animator/fragment_fade_enter</item>
<item name="fragmentFadeExitAnimation">@animator/fragment_fade_exit</item>
</style>
<!-- Standard animations for a non-full-screen window or activity. -->
<style name="Animation.Dialog">
<item name="windowEnterAnimation">@anim/dialog_enter</item>
<item name="windowExitAnimation">@anim/dialog_exit</item>
</style>
<!-- Standard animations for a translucent window or activity. This
style is <em>not</em> used by default for the translucent theme
(since translucent activities are a special case that have no
clear UI paradigm), but you can make your own specialized theme
with this animation style if you would like to have the standard
platform transition animation. -->
<style name="Animation.Translucent">
<item name="windowEnterAnimation">@anim/translucent_enter</item>
<item name="windowExitAnimation">@anim/translucent_exit</item>
</style>
<!-- Standard animations for a non-full-screen window or activity. -->
<style name="Animation.LockScreen">
<item name="windowEnterAnimation">@anim/lock_screen_enter</item>
<item name="windowExitAnimation">@anim/lock_screen_exit</item>
</style>
<style name="Animation.OptionsPanel">
<item name="windowEnterAnimation">@anim/options_panel_enter</item>
<item name="windowExitAnimation">@anim/options_panel_exit</item>
</style>
<style name="Animation.SubMenuPanel">
<item name="windowEnterAnimation">@anim/submenu_enter</item>
<item name="windowExitAnimation">@anim/submenu_exit</item>
</style>
<style name="Animation.TypingFilter">
<item name="windowEnterAnimation">@anim/grow_fade_in_center</item>
<item name="windowExitAnimation">@anim/shrink_fade_out_center</item>
</style>
<style name="Animation.TypingFilterRestore">
<item name="windowEnterAnimation">@null</item>
<item name="windowExitAnimation">@anim/shrink_fade_out_center</item>
</style>
<style name="Animation.Toast">
<item name="windowEnterAnimation">@anim/toast_enter</item>
<item name="windowExitAnimation">@anim/toast_exit</item>
</style>
<style name="Animation.DropDownDown">
<item name="windowEnterAnimation">@anim/grow_fade_in</item>
<item name="windowExitAnimation">@anim/shrink_fade_out</item>
</style>
<style name="Animation.DropDownUp">
<item name="windowEnterAnimation">@anim/grow_fade_in_from_bottom</item>
<item name="windowExitAnimation">@anim/shrink_fade_out_from_bottom</item>
</style>
<!-- Window animations that are applied to input method overlay windows. -->
<style name="Animation.InputMethod">
<item name="windowEnterAnimation">@anim/input_method_enter</item>
<item name="windowExitAnimation">@anim/input_method_exit</item>
</style>
<!-- Window animations that are applied to voice activity windows. -->
<style name="Animation.VoiceActivity">
<item name="windowEnterAnimation">@anim/voice_activity_open_enter</item>
<item name="windowExitAnimation">@anim/voice_activity_close_exit</item>
</style>
<!-- Window animations that are applied to voice interaction overlay windows. -->
<style name="Animation.VoiceInteractionSession">
<item name="windowEnterAnimation">@anim/voice_layer_enter</item>
<item name="windowExitAnimation">@anim/voice_layer_exit</item>
</style>
<!-- Special optional fancy IM animations. @hide -->
<style name="Animation.InputMethodFancy">
<item name="windowEnterAnimation">@anim/input_method_fancy_enter</item>
<item name="windowExitAnimation">@anim/input_method_fancy_exit</item>
</style>
<!-- Window animations that are applied to the search bar overlay window.
Previously used, but currently unused.
{@hide Pending API council approval} -->
<style name="Animation.SearchBar">
<item name="windowEnterAnimation">@anim/search_bar_enter</item>
<item name="windowExitAnimation">@anim/search_bar_exit</item>
</style>
<!-- Window animations that are applied to the zoom buttons overlay window. -->
<style name="Animation.ZoomButtons">
<item name="windowEnterAnimation">@anim/fade_in</item>
<item name="windowExitAnimation">@anim/fade_out</item>
</style>
<!-- Standard animations for wallpapers. -->
<style name="Animation.Wallpaper">
<item name="windowEnterAnimation">@anim/wallpaper_enter</item>
<item name="windowExitAnimation">@anim/wallpaper_exit</item>
</style>
<!-- A special animation we can use for recent applications,
for devices that can support it (do alpha transformations). -->
<style name="Animation.RecentApplications">
<item name="windowEnterAnimation">@anim/recents_fade_in</item>
<item name="windowShowAnimation">@anim/recents_fade_in</item>
<item name="windowExitAnimation">@anim/recents_fade_out</item>
<item name="windowHideAnimation">@anim/recents_fade_out</item>
</style>
<!-- A special animation value used internally for popup windows. -->
<style name="Animation.PopupWindow" />
<!-- Window animations used for action mode UI in overlay mode. -->
<style name="Animation.PopupWindow.ActionMode">
<item name="windowEnterAnimation">@anim/fade_in</item>
<item name="windowExitAnimation">@anim/fade_out</item>
</style>
<!-- Window animations used for volume panel. -->
<style name="Animation.VolumePanel">
<item name="windowEnterAnimation">@null</item>
<item name="windowExitAnimation">@anim/fade_out</item>
</style>
<!-- Window animations used for immersive mode confirmation. -->
<style name="Animation.ImmersiveModeConfirmation">
<item name="windowEnterAnimation">@null</item>
<item name="windowExitAnimation">@anim/fast_fade_out</item>
</style>
<!-- Window animations for screen savers. {@hide} -->
<style name="Animation.Dream">
<item name="windowEnterAnimation">@anim/slow_fade_in</item>
<item name="windowExitAnimation">@anim/fast_fade_out</item>
</style>
<!-- Status Bar Styles -->
<style name="TextAppearance.StatusBar">
<item name="textAppearance">?attr/textAppearanceSmall</item>
</style>
<style name="TextAppearance.StatusBar.Ticker">
</style>
<style name="TextAppearance.StatusBar.Title">
<item name="textStyle">bold</item>
</style>
<style name="TextAppearance.StatusBar.Icon">
</style>
<!-- Notification content styles -->
<style name="TextAppearance.StatusBar.EventContent">
<item name="textColor">#999999</item>
<item name="textSize">@dimen/notification_text_size</item>
</style>
<style name="TextAppearance.StatusBar.EventContent.Title">
<item name="textColor">#ffffff</item>
<item name="fontFamily">sans-serif-light</item>
<item name="textSize">@dimen/notification_title_text_size</item>
<item name="textStyle">bold</item>
</style>
<style name="TextAppearance.StatusBar.EventContent.Line2">
<item name="textSize">@dimen/notification_subtext_size</item>
</style>
<style name="TextAppearance.StatusBar.EventContent.Info">
<item name="textSize">@dimen/notification_subtext_size</item>
<item name="textColor">#999999</item>
</style>
<style name="TextAppearance.StatusBar.EventContent.Time">
<item name="textSize">@dimen/notification_subtext_size</item>
<item name="textColor">#999999</item>
</style>
<style name="TextAppearance.StatusBar.EventContent.Emphasis">
<item name="textColor">#CCCCCC</item>