Android:删除活动转换之间的空格/黑条

Android:删除活动转换之间的空格/黑条,android,android-activity,android-animation,android-transitions,Android,Android Activity,Android Animation,Android Transitions,我有两项活动:活动1和活动2。我希望Activity2从Activity1的底部滑入,同时Activity1推出 然而,这些活动之间存在一个黑色的间隙(参见下图) 下面是我的转换代码 在\u bottom.xml中滑动 <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <translate and

我有两项活动:活动1活动2。我希望Activity2从Activity1的底部滑入,同时Activity1推出

然而,这些活动之间存在一个黑色的间隙(参见下图)

下面是我的转换代码

在\u bottom.xml中滑动

<?xml version="1.0" encoding="utf-8"?>
<set
  xmlns:android="http://schemas.android.com/apk/res/android">
    <translate android:interpolator="@android:anim/accelerate_interpolator"
        android:duration="10000"
        android:fillAfter="true"
        android:fromYDelta="100.0%p" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<set
  xmlns:android="http://schemas.android.com/apk/res/android">
    <translate android:interpolator="@android:anim/accelerate_interpolator"
        android:duration="10000"
        android:fillAfter="true"
        android:fromYDelta="100.0%p" />
</set>

滑出\u top.xml

<?xml version="1.0" encoding="utf-8"?>
<set
  xmlns:android="http://schemas.android.com/apk/res/android">
    <translate android:interpolator="@android:anim/accelerate_interpolator"
        android:duration="10000"
        android:fillAfter="true"
        android:fromYDelta="100.0%p" />
</set>
<?xml version="1.0" encoding="utf-8"?>
<set
  xmlns:android="http://schemas.android.com/apk/res/android">
    <translate android:interpolator="@android:anim/accelerate_interpolator"
        android:duration="10000"
        android:fillAfter="true"
        android:fromYDelta="100.0%p" />
</set>

所以我的问题是:我如何摆脱这个空白/空白?我已经在StackOverflow上查看了源代码,我发现半透明主题对我不起作用

谢谢

ColorDrawable colorDrawable = new ColorDrawable( Color.TRANSPARENT );
getWindow().setBackgroundDrawable( colorDrawable );
或者,如果你有特殊的背景

getWindow().setBackgroundDrawable( getResources().getDrawable( R.drawable.bg ));

资料来源:

你找到解决办法了吗?很好!干得好