4

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

但是,活动之间存在黑色差距(见下图)。

活动之间的差距

以下是我的转换代码。

slide_in_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>

slide_out_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>

所以我的问题是:我如何摆脱这个差距/黑色空间?我已经在 StackOverflow 上查看了这里的资源,并且我的半透明主题对我不起作用。

谢谢!

4

1 回答 1

2
ColorDrawable colorDrawable = new ColorDrawable( Color.TRANSPARENT );
getWindow().setBackgroundDrawable( colorDrawable );

或者,如果你有特定的背景,

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

来源:https ://stackoverflow.com/a/6396465/1510502

于 2015-10-22T17:43:02.477 回答