ThePedestrian
ThePedestrian

Reputation: 839

Android: Removing Space/Black Bar Between Activity Transition

I have two activities: Activity1 and Activity2. I wish to have Activity2 slide in from the bottom of Activity1 while at the same time Activity1 pushes out.

However, there is a black gap between the activities (see figure below).

gap between the activities

The following is my code for transitions.

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>

So my question is: how do I get rid of this gap/black space? I've checked out sources here on StackOverflow and I a Translucent theme doesn't work for me.

Thanks!

Upvotes: 4

Views: 872

Answers (1)

Miguel Diaz
Miguel Diaz

Reputation: 441

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

Or, if you have a particular background,

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

Source: https://stackoverflow.com/a/6396465/1510502

Upvotes: 3

Related Questions