我正在使用黑色背景的活动。同样的活动也有一个工具栏和一个DrawerLayout。这个白色屏幕使外观不一致。
当打开活动时有一个非常慢的幻灯片转场时,这一点会变得更加明显。
有什么方法可以去掉它吗?
在第二个活动上设置enter转换的代码:
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = activity.getWindow();
Slide slide = new Slide();
slide.setSlideEdge(Gravity.RIGHT);
slide.excludeTarget(android.R.id.statusBarBackground, true);
slide.excludeTarget(android.R.id.navigationBarBackground, true);
window.setEnterTransition(slide);
window.setExitTransition(slide);
}
我的风格
<!-- Base application theme. -->
<style name="AppTheme" parent="Theme.AppCompat.Light">
<!-- Customize your theme here. -->
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowActivityTransitions">true</item>
<item name="android:windowContentTransitions">true</item>
<item name="android:windowAllowEnterTransitionOverlap">false</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowSoftInputMode">stateAlwaysHidden|adjustResize</item>
</style>
发布于 2017-11-29 17:46:35
我也有这个问题,但对于片段转换,因为所有的解决方案都只是设置窗口背景,这可能适用于活动,我并没有真正得到任何结果。比我想的要好,让我们试着在我推送到=>的片段中设置rootview的背景。瞧,这就成功了。因此,我正在推送的片段的根视图在xml中如下所示:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/transparent">
https://stackoverflow.com/questions/33561523
复制相似问题