How to avoid the white screen before first activity is shown? - android

When opening my app for the first time, i can see a white screen for two or three seconds. After that, the first activity is shown.
¿How to avoid this annoying white screen? I'm pretty sure it's caused by the theme Theme.AppCompat.Light.DarkActionBar which I'm using.
I'm using this new theme because I'm using a NavigationView with a PagerTitleStrip and in the documentation of google they where using this theme to develop this kind of views.
How can i avoid that annoying white screen? If that screen can be for example black, it is munch better and munch less annoying. Can its color be changed? Has this theme a black version but without losing compatibility with a NavigationView with a PagerTitleStrip?
Thank you.

On your xml that you are using for your splashscreen add
android:opacity="opaque"

As cricket_007 tell in the comments, it is possible to get black color theme instead of Light simply using "Theme.AppCompat"
Also as CommonsWare tell us, too in the comments, it is a good practice to search if you are doing too much work in the main thread and use threads to get a fast ui load.
Thank you guys

Related

Chrome Mobile, Change System Navigation Bar (Back, Home, Recent Buttons) Background Color?

recent update to google chrome on android makes the navigation bar background white & dark themed sites look crappy with this at the bottom imo (screenshot below).
im wondering if there is a way to control the color with meta tags or something similar to how the top area theme color can be controlled like...
<meta name="theme-color" content="#353535" />
or any sorta way to alter this? even just setting to black would be great, dont really need a custom color. tried looking around through documentation but couldnt find anything exact, might not be doable. apologize if my terminology might be off.
screenshot of the white navigation bar at the bottom for reference
This is not fixable in Chrome 67. Whether or not it will be fixed is tracked in this chromium issue. Star it if you're interested in the issue getting more attention
https://bugs.chromium.org/p/chromium/issues/detail?id=797527
According to what I saw, there isn't a way to do this now. Maybe Google will add a way to do this in a future update but for now they are apparently using this to limit the burn in on the screens.
So we are unfortunately stuck with it for now

Android: Support Fragments don't apply activity theme?

At the moment, I'm stuck with a very annoying kind of "bug" I assume regarding all Pre-Lollipop Android versions. It appears that (support) fragments don't apply the activity's theme they're assigned to. To make my explanations a bit easier, have the following demonstration:
My app runs with a turquoise theme at first. Let's say, the user decided to change the turquoise theme to a red theme. He or she restarts the app and is greeted with the following:
(screenshot taken on an Android 4.4.2 tablet)
Terrible sight, isn't it? However, if I run the same app in an emulator with Android L the whole theme problem doesn't even seem to exist.
There's especially one thing which seems odd about the tablet screenshot. The fragment itself doesn't apply the theme but child components inside the fragment which get added lateron (like the view with the exclamation mark which is hosted by a ViewPager) take and apply the theme as if nothing happened.
I'm not quite sure what the issue might be. I've done everything as stated in every document available. I set the theme before I call setContentView(resource) in the corresponding activity. I tried to do the trick with ContextThemeWrapper but it was no use.
Relevant code:
The activity's onCreate()
The fragment's onCreateView()
The fragment's layout
Attributes
Themes (a lot of them)
I tried to resolve this issue for days now and I still can't find out why this is not working. I haven't found a suitable answer yet and would love some advise.
I've been the victim to my own stupidity. I had another close look on my project setup and found this:
My tablet takes its layout resources from the sw600dp-folder, but I forgot to change the corresponding layout to take attributes instead of hardcoded colors. I think I have to retire after making such a stupid mistake.

Full screen changes normal design

I tried to run my activity in full screen mode using this method:
android:theme="#android:style/Theme.NoTitleBar.Fullscreen
But after it my all design were changed. My Edittext-s which had only a line below now become rectangles and buttons design are changed too.
How to avoid this situation?
Try this theme instead:
android:theme="#android:style/Theme.Holo.Light.NoActionBar.Fullscreen"
The theme you are applying to your Activity is old and I think even deprecated. The Holo themes are the ones you are looking for.

Trouble with Android UI: main theme does not match with popups' theme

So I am still working on my messaging app, and I have successfully implemented a few popups on my own, but then they don't turn out exactly as I want...
The theme is supposed to be strictly black text on white background, zero transparency (Theme.Light.NoTitleBar). While I have no problems whatsoever in the activity itself, my trouble is with the popups, whose theme does not seem to match as I expected. Can anybody tell me how to fix these?
It looks like after much trial and error, I only had to force the views to use specific styles/themes.
For the popup menu (PopupWindow):
menu.setBackgroundDrawable(getResources().getDrawable(
android.R.color.background_light));
For the dialog (DialogFragment), it's...:
setStyle(android.R.style.Widget_ListView, android.R.style.Theme_NoTitleBar);
...Or it just corrected itself.

Tips for making the Android launcher transparent

I'm designing a custom Android 4.0 (ICS) device for special purpose.
One of the things I'm looking for is a way to make the Android Launcher, when other activities were previously running, show the last running activity as a transparent, dimmed background, with the launcher icons and widgets on top.
What I'm looking for, is something like this: How do I create a transparent Activity on Android?, except as a modification to Launcher2. I guess I can apply a similar style to the launcher as proposed in that SO, but what about the wallpaper?
AFAIU, the wallpaper is rendered by a separate service, and I still want it rendered if there are no other activities behind the launcher.
Any tips?
I figured this one out myself eventually. It turned out pretty simple.
Just modify the theme as suggested in the mentioned SO-article, and simply change inheritance from the Wallpaper-enabled theme.
Also, there were a small code-snippet that was reactivating the wallpaper. Switch that out, and I've now got a transparent launcher, that shows what's going on behind it.

Categories

Resources