I have a freshly created Flutter app, and I configured my splash screen to display some background color and app icon in the middle.
By default, Android splash starts with status bar that looks dark semi-transparent. I wanted to change the color to be the same as splash background. I managed do this:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="#android:style/Theme.NoTitleBar">
<item name="android:windowBackground">#drawable/launch_background</item>
<item name="android:colorPrimaryDark">#color/splash_color</item>
<item name="android:statusBarColor">#color/splash_color</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
</style>
</resources>
It works, but only for the few first milliseconds. After that, the logo jumps up a little and status bar appears again. This happens before main method even starts.
How can I setup this so that status bar looks exactly the same from the start, until home page is shown?
EDIT:
I prepared source code: https://github.com/szotp/splash_status_problem
The jump up does not appear in completely now project for some reason, but this semi transparent background can be seen.
#szotp, i had similar issue when i tried to implement splash screen so i used flutter_native_splash package instead. It auto-generates native code for splash screens, all you need to do is provide image and color. It will merge your status bar with same color as your screen background color. Not sure what yours look like but it worked really well for me.
Related
I am trying to make an android app that with accesibility permissions draws over any app at the very top of my phone (at the status bar). The problem is that the top of the XML is not the top of the screen, it stays below the status bar. And yes, my app is at full screen mode (copyed some code of the full screen activity template in android studio). This is my first post and I am starting to android studio. Thanks in advance.
create a new Style in Styles.xml and use it under the activity you want as full screen , it will cover the status bar
<style name="Theme.fullScreen" parent="Theme."MainTheme">
<item name="android:windowLayoutInDisplayCutoutMode"
tools:targetApi="o_mr1">shortEdges</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>
I'm new to Android studio and I figured out how I can send my application to my phone. The problem is, In the preview, At the bottom, it has this auction bar (See photo) Is there a way to get rid of that? Because my phone (Samsung Galaxy S6 Edge) Does not have that, And it sits in the way if I want to place something at the very bottom. Because in android studio it may be at the very bottom, But on my phone, it isn't.
Also, Is there a way to make that top bar, That is now black, Sort of transparent? So it takes the colour of the background? You see it in a lot of apps. As I mentioned, I'm very new in android studio so sorry.
Thanks in advance
The control bar at the bottom is part of the emulator aka any phone without hard buttons. You can toggle to full screen and it will hide it for you.
For example code simply create new activity and select fullscreen activity. You will see that it manages it by touch of surface to reappear and timer to dissappear. Just remove that bloat and handle it yourself. Done !
As for the status bar at the top, it uses your activity default background. So if you want to change this go to your styles and add a background to your AppTheme and this will be the default background color of unspecified areas instead of black.
Example:
<style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
<!-- Customize your theme here. -->
<item name="colorPrimary">#color/colorPrimary</item>
<item name="colorPrimaryDark">#color/colorPrimaryDark</item>
<item name="colorAccent">#color/colorAccent</item>
<item name="android:windowBackground">#color/blue</item>
<item name="android:actionMenuTextColor">#color/white</item>
</style>
The windowBackground color will drive the background color of unspecified areas unless you override the theme on any particular activity in the manifest. Goodluck.
I am making an app which has a widget, which has a black background. The alpha of the black background can be changed in a widget config screen from transparent to fully opaque black.
My question is about the config activity. Id like to show the widget in the middle of the screen, with its area transparent, so the home screen behind it is visible, so the user can pick which alpha suits it the most. Kind of like the music player Shuttle has it. How can it be done? Can I somehow take a screenshot of the background without all the icons, or do I somehow get a reference to the home screen background?
Thanks a lot!
okay Ive got it, what you need to do is use this in the config theme
<style name="MyWidgetConfigTheme" parent="#style/AppTheme">
<item name="android:windowBackground">#android:color/transparent</item>
<item name="android:windowShowWallpaper">true</item>
</style>
I have an app that is using Viewpagerindicator. I am using the tabs portion of it. I use a black background and the default blue indicator color. I wanted to add an actionbar to my app so I started using Actionbarsherlock. In order to get my tabs to show an the action bar to show I created my own them which is called in my manifest file. The theme I created is this:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<!-- This is our main ActionBarSherlock theme -->
<style name="Theme.Styled" parent="Theme.Sherlock.Light.DarkActionBar">
</style>
<style name="Theme.VPI" parent="Theme.Styled">
<item name="vpiTitlePageIndicatorStyle">#style/Widget.TitlePageIndicator</item>
<item name="vpiTabPageIndicatorStyle">#style/Widget.TabPageIndicator</item>
<item name="vpiTabTextStyle">#style/Widget.TabPageIndicator.Text</item>
</style>
</resources>
When I run the app, I get my blue indicator color but the background of the entire app is white.
Originally I was how this code inside:
<style name="Theme.VPI" parent="Theme.Styled">
<item name="vpiTabPageIndicatorStyle">#style/CustomTabPageIndicator</item>
</style>
That gave me red indicators with a white background. I know the custom tabs are red with a white background and that is why I changed it from CustomTabPageIndicator to Widget.TabPageIndicator. However, I am still getting an all white background.
I have tried to just make my layout have a black background inside of my pageviewer, however when I do that, my buttons become really dark and unreadable.
My main question is to find where I can change the color inside of the Viewpagerindicator theme.
Any suggestions would be much appreciated. Thank You.
Visit this example; Making ActionBarSherlock and ViewPagerIndicator play nice
Possible Bug in that example; Android - SupportMapFragment with GoogleMaps API 2.0 giving IllegalArgumentException
Good Luck..!!
I'm using a custom title bar in my app and it all works fine except that when the app starts up, the original (standard) android title bar is shown for a brief time before it is replaced by my custom title bar.
This is not a problem when the app is already loaded in memory because the 'delay' is not apparent but if the app is not already in memory, it is very obvious.
There's nothing special about the code :
requestWindowFeature(Window.FEATURE_CUSTOM_TITLE);
setContentView(R.layout.main);
getWindow().setFeatureInt(Window.FEATURE_CUSTOM_TITLE, R.layout.window_title);
I thought about changing the style to have no window title and just include my custom title in the top of the layout but that doesn't seem right.
Thanks for any pointers.
Thomas Devaux has posted a smart solution. It worked in my app
Change the windowTitleBackgroundStyle to use color “#android:color/transparent”.
Also create a style for the text “android:windowTitleStyle” and set its “android:textColor” >to transparent as well.
For completeness to Lluis' answer, here's the full code you need to hide the default-title before the custom-title is initiated:
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:android="http://schemas.android.com/apk/res/android">
<style name="CustomWindowTitleStyle">
<item name="android:textColor">#android:color/transparent</item>
</style>
<style name="CustomTheme" parent="#android:style/Theme.Holo">
<item name="android:windowActionBar">false</item>
<item name="android:windowTitleBackgroundStyle">#android:color/transparent</item>
<item name="android:windowTitleSize">50dp</item>
<item name="android:windowTitleStyle">#style/CustomWindowTitleStyle</item>
</style>
</resources>
add a splash screen activity before the main activity loads, should have enough time for the next one to load properly
Are you able to use an app theme to set a custom title globally for your app? See here for a pretty good example. I had a similar problem and i seem to remember going this route fixed it.