How to remove Black background between start new activity during slide_left animation?
set the theme of that activity as transluscent in manifest file
android:theme="@android:style/Theme.Translucent"
so your code will be something like this
<activity android:name=".AdActivity"
android:theme="@android:style/Theme.Translucent" />
Activity transition black screen
What I always do is to start an activity(any way you want, ways are listed here).
I use slide transitions using these two files:
slide_out_left.xml:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromXDelta="0"
android:toXDelta="-100%p" />
</set>
slide_in_right.xml:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate
android:duration="@android:integer/config_mediumAnimTime"
android:fromXDelta="100%p"
android:toXDelta="0" />
</set>
Then I start an activity like this(this is java):
startActivity(MainActivity.this, SecondActivity.class);
overridePendingTransition(R.anim.slide_in_right.xml, R.anim.slide_in_left.xml);
finish();
Using this, the activity exits giving way to the new one smoothly from right to left.
For the black screen, set the theme of that activity as translucent in the AndroidManifest.xml
file
android:theme="@android:style/Theme.Translucent"
so your code will be something like this
<activity android:name=".Activity"
android:theme="@android:style/Theme.Translucent" />
Answer for the black screen taken from: https://stackoverflow.com/a/6468734/9819031
How do I get rid of this black bar during animation?
Okay, I tried a few things, like making the deltas relative to the parent, etc. I think the core problem is that the activity has extra space at the top, which is that black bar. There's not really anything to be done about it as far as I can see except to pull it out of the activity and make it a view.
Placing that view into a ViewAnimator and then setting the in and out transitions to those I already listed works like a charm. I'm fairly convinced that there is no other way to do this. If anyone ever figures one out, let me know, but this solves my problem.
Smooth transition between activities without black screen
One of the simplest way is to move all the expensive (time-consuming) processing from your activity's onCreate and onStart method to onResume mthod. By this, your newly launched activity will be visible right after its launched but then will take a little extra to make it available for user to interact. Further, I would suggest you to move all the heavy lifting in AsyncTask for smoother UI experience.
Related Topics
Change Button Text and Action - Android Development
How to Access an Existing Sqlite Database in Android
How to Fetch Data from a Web Server in an Android Application
How to Make Space Between Linearlayout Children
Android Build Gradle Is Too Slow (Dependency Resolution)
Crop Square Image to Circle - Programmatically
Combining Two Bitmap Image (Side by Side)
Change The Background Color of Cardview Programmatically
What Would Happen If Android App Is Released with Debuggable On
Viewpager Update Fragment on Swipe
Android Listview with Checkbox Problem
Selecting Contact from Autocomplete Textview
How to Print a Double with Two Decimals in Android
How to Measure Upload/Download Speed and Latency in Android Wifi Connection
Android Send a Image and Save Url