Splash screen showing on the background of main activity - android

I've set a splash screen on my app using this guide.
The background of my app is a transition color (changing color every few seconds using animation-list.
After the splash screen is shown (at the startup of the app), it stays in the background of the main activity.
screenshot
This is spalsh_screen.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android" >
<item android:drawable="#android:color/white"/>
<item>
<bitmap
android:src="#drawable/talki_logo_big"
android:gravity="center"/>
</item>
</layer-list>
This is the animation_list.xml
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:visible="true">
<item
android:drawable="#drawable/gradient_background_1"
android:duration="2500" />
<item
android:drawable="#drawable/gradient_background_2"
android:duration="2500" />
<item
android:drawable="#drawable/gradient_background_3"
android:duration="2500" />
<item
android:drawable="#drawable/gradient_background_4"
android:duration="2500" />
<item
android:drawable="#drawable/gradient_background_5"
android:duration="2500" />
</animation-list>
Is there a way to make the splash screen disappear?
Thanks! :)

The solution is already there in the tutorial you linked.
The easiest way to transition back to your normal theme is to call
setTheme(R.style.AppTheme) before super.onCreate() and
setContentView().
public class MyMainActivity extends AppCompatActivity {
#Override
protected void onCreate(Bundle savedInstanceState) {
// Make sure this is before calling super.onCreate
setTheme(R.style.Theme_MyApp);
super.onCreate(savedInstanceState);
// ...
}
}
Reason of Fail
You have set AppTheme.Launcher in manifest, which gives a background to Activity. Now after Activity is started, you need to change that theme to your App theme to remove the Splash Background.

Try to add the property android:noHistory="true" in the manifest for your splashscreen activity.
A value of "true" means that the activity will not leave a historical trace. It will not remain in the activity stack for the task, so the user will not be able to return to it and maybe it won't show in the background.

Related

How to avoid black screen during acitivy.recreate()

requireActivity().recreate()
I'm using above code after chainging locale. there's a black screen during requireActivity().recreate() (for about 0.3sec).
I wanna change the black screen with splash screen or progress bar...
Is there any way to do it? Thank you.
when you call requireActivity().recreate() new instance of activity will be created and it takes some time so in this duration, you will see the default background of the window , you can change the defaults but it doest support progress bar , you can change the color and add a drawable to it which I think helps you enough
In order to remove the default black screen make a custom theme:
in drawable folder:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape>
<!-- black background -->
<solid android:color="#color/colorBlack" />
</shape>
</item>
<!-- launcher icon -->
<item android:drawable="#mipmap/ic_launcher_foreground" android:height="150dp" android:width="150dp" android:gravity="center" />
then configure it in your styles file:
<item name="android:windowBackground">#drawable/starting_screen</item>
hope it helped 👍🏻👍🏻

Changing xamarin android launcher theme that even applicable to preview window

I use a style as theme for my splash activity that also is MainLauncher. This is my splash screen drawable:
<?xml version="1.0" encoding="utf-8" ?> <layer-list
xmlns:android="http://schemas.android.com/apk/res/android"> <item
android:id="#+id/itemSplashScreenBackgroundColor">
<shape android:shape="rectangle">
<solid android:color="#color/colorAppOrangeTheme" />
</shape> </item> <item>
<bitmap
android:src="#drawable/LogoSplashScreen"
android:tileMode="disabled"
android:gravity="center" /> </item> </layer-list>
And here is my style.xml file that uses mentioned drawable:
<resources> <style name="styleAppSplashScreenTheme"
parent="android:Theme.DeviceDefault.NoActionBar">
<item name="android:scaleType">center</item>
<item name="android:windowBackground">#drawable/XMLFileSplashScreen</item>
<item name="android:windowDisablePreview">false</item>
<item name="android:windowFullscreen">true</item>
<item name="android:windowNoTitle">true</item> </style> </resources>
As you see, to start my app quickly (user see app interaction quickly after tap app icon) I use value of windowDisablePreview as false.
Now I change background color of the splash screen by below coding in Activity OnCreate method:
LayerDrawable layerDrawable = (LayerDrawable)ContextCompat.GetDrawable(this, Resource.Drawable.XMLFileSplashScreen);
GradientDrawable gradientDrawable = (GradientDrawable)layerDrawable.FindDrawableByLayerId(Resource.Id.itemSplashScreenBackgroundColor);
if (stringAppThemeName == "Orange")
{
gradientDrawable.SetColor(ContextCompat.GetColor(this, Resource.Color.colorAppOrangeTheme));
}
else if (stringAppThemeName == "Blue")
{
gradientDrawable.SetColor(ContextCompat.GetColor(this, Resource.Color.colorAppBlueTheme));
}
base.OnCreate(bundleSavedInstanceState);
The problem is here when I relaunch the app it first loads the style with its default color (#color/colorAppOrangeTheme) for a moment then changes to desired color!
Several solutions I saw like setting windowDisablePreview to true but I don't want to void of preview window, I want to change color of splash screen background color even in preview window.
Please suggest applicable solution. Thanks.

Qt Quick Controls 2 Splash Screen

I am developing a mobile app using Qt Quick Controls 2, and would like to display a splash screen while the app is being initialised. Currently, this is what the user sees when the app is started:
A dark background with the name of the app as a header.
A blank, white background.
The application window.
In that order for an Android 6 Marshmallow smartphone. If I add the splash screen to the application window, perhaps in a stack view, and then transition to the actual contents when it is initialised, (1) and (2) would still remain, right? Is there any way to tell Qt to display the splash screen instead of (1) and (2), or at least instead of (1)?
First in _yourProject_/android/res/drawable create a splash.xml file:
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<shape android:shape="rectangle" >
<solid android:color="#353535"/>
</shape>
</item>
<item>
<bitmap android:src="#drawable/icon" android:gravity="center" />
</item>
</layer-list>
That sets the splash screen background color and icon that will be centered on the screen.
Then in /android/res/values create a theme.xml file:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="AppTheme" parent="#android:style/Theme.DeviceDefault.Light.NoActionBar">
<item name="android:windowBackground">#drawable/splash</item>
</style>
</resources>
Then in the android manifest file, on the line <activity android:configChanges= add android:theme="#style/AppTheme" after the label settings, then scroll down to the <!-- Splash screen --> section and uncomment and modify the line:
<meta-data android:name="android.app.splash_screen_drawable" android:resource="#drawable/splash"/>
Replace the #353535 color with whatever the color of your application window is set to for smooth transition. The image is optional.
I just tested that and it works. Perhaps someone else will be able to provide a solution for iOS.

Android custom seekbar's progress not aligned with background

I am creating a custom SeekBar using 9 patch images.
The problem here is that on the first launch, the progress section is not aligned with the background.
Here's what it looks like on first launch:
And here's what it should look like, and actually looks like on later launches of the application:
The first behavior only appears after compilation or the application is killed in the app manager.
Here's the code for the progress bar:
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="#android:id/background"
android:drawable="#drawable/bar_whole"/>
<item android:id="#android:id/progress">
<clip android:drawable="#drawable/bar_selected" />
</item>
</layer-list>
One thing that might be of interest as well, I set the thumb and progress drawables when constructing the object:
protected void init()
{
this.setProgressDrawable(getResources().getDrawable(R.drawable.volume_progress));
this.setThumb(getResources().getDrawable(R.drawable.volume_thumb));
}
Thanks.

remove back arrow in ContextualActionBar

My Application uses an Activity (extends AppCompatActivity) with a ListView.
The title-row shows a title and a back-arrow.
A ContextualActionBar is assigned to the ListView.
When the ContextualActionBar gets active, because a long click to one item of the ListView, the back-arrow should be removed.
Please, could anybody give a hint, how to remove the back-arrow of the ContextualActionBar?
Thank You very much!
Best Regards
Uli
It's not really recommended to remove the back arrow, but you can assign it to a transparent drawable
<style name="MyCustomTheme" parent="MyTheme">
<item name="android:actionModeCloseDrawable">#drawable/transparent_drawable</item>
</style>
Where transparent drawable is :
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
<solid android:color="#00FFFFFF"/>
</shape>
and then set it in your manifest
<activity
android:name="MyActivity"
android:theme="#style/MyCustomTheme"

Categories

Resources