Android status bar - can it be transparent? - android

Can Android status bar be transparent like in iOS? I want it to blend into activity like on iOS. Can it be done and if yes - how?
EDIT: Just to clarify I need to make status bar transparent, not action bar, and yes I know I can completely hide it - but that's not what I'm asking.

No you can't make the system status bar transparent, and shouldn't try to do so in an attempt to mimic iOS:
Don't mimic UI elements from other platforms

Android 4.4 KitKit now allows translucent status and navigation bars:
http://developer.android.com/about/versions/android-4.4.html#UI
For example, you can set the theme as Theme.Holo.NoActionBar.TranslucentDecor.

You can make your activity fullscreen so you won't see the status bar.
Like this :
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.main);
Or set a theme like this
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"

It can be done.
Take a look at the following library which basically implements a fading action bar, starting from fully transparent.
https://github.com/ManuelPeinado/FadingActionBar

Related

Android transparent status bar implementation?

I noticed Play Store application detail pages show a transparent status bar since version 5.4, but how is it implemented?
I tried to add WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS flag to my window, but the result is both the status bar and the navigation bar are transparent. How can I just make the status bar transparent but the navigation bar keeps normal?
I see your link and see that:
+If you want collapse toolbar like this. Try [CoordinatorLayout][2].
+If you just want transparent toolbar try: android:background="#android:color/transparnt" on toolbar.
Sorry if I misunderstood your question

Activity Full Screen in Android

I am trying to make like Trello application, see in the screenshot of Trello, they covered complete screen with background but still time, network show in title bar, I want to do same in my application such that set background to complete full screen and should show network and time.
I am trying this but it didn't work for me.
#Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_main);
}
Update
Removing the action bar
You can hide the action bar at runtime by calling hide(). For example:
ActionBar actionBar = getSupportActionBar();
actionBar.hide();
https://developer.android.com/guide/topics/ui/actionbar.html
For a translucent system bar (like in trello) see this:
Translucent system bars
You can now make the system bars partially translucent with new
themes, Theme.Holo.NoActionBar.TranslucentDecor and
Theme.Holo.Light.NoActionBar.TranslucentDecor. By enabling translucent
system bars, your layout will fill the area behind the system bars, so
you must also enable fitsSystemWindows for the portion of your layout
that should not be covered by the system bars.
If you're creating a custom theme, set one of these themes as the
parent theme or include the windowTranslucentNavigation and
windowTranslucentStatus style properties in your theme.
http://developer.android.com/about/versions/android-4.4.html#UI
try this:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,windowManager.LayoutParams.FLAG_FULLSCREEN);
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
Android introduced a Immersive Full Screen Mode concept from Android 4.4, here you can see https://developer.android.com/training/system-ui/immersive.html that solved my problem.

ActionBar Sherlock Progress Bar in Icon space

I am using an Action bar in my project. I am displaying a progress bar via the below approach.
requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setProgressBarIndeterminateVisibility(true);
However, what I'd really like to do is replace the left most image icon with the progress indicator when arbitrary background processes run and then returns the usual icon when complete.
Can anyone tell me the steps needed to replace this icon with a functional Progress indicator. It only needs to be an intermediate one.
Looks like you can find some suggestions here: Android: dynamically change ActionBar icon?.
Specifically, you can access the icon by using
Activity.findViewById(android.R.id.home)
And then just set and re-set the icon as needed.
You need to build a custom layout for this and use actionbar.setCustomView(yourcustomlayout);
In your custom layout have an imageView(which is your app icon) and progress bar(initially which is set to invisible).
When running the background process just set the visibility between image view and progress bar.

How to make application overlapping with status bar which already has transparent background in Android

I'm now customizing theme through some framework files. The problem is that I've made the status bar with transparent background. But there's an obvious side line between status bar and the application. How can I merge them together? Looks like the application align to the top of the screen but the status bar also exist.
Thanks in advance.
Please find WindowManager.LayoutParams.TYPE_STATUS_BAR in StatusBarService.java and replace it with WindowManager.LayoutParams.TYPE_SYSTEM_OVERLAY.
I think it is what you want.

How do I hide the action bar icon in Android using a theme?

While I do know that you can hide the icon in the action bar by using setDisplayUseLogoEnabled, this takes a while and will result in the icon flashing for a second. Is there a way to avoid this by using themes or any other solution?
assuming you're after a full screen view, try looking at the
WindowManager.LayoutParams.FLAG_FULLSCREEN
flag in the Window class
Try using getActionBar().setDisplayOptions(ActionBar.DISPLAY_USE_LOGO)

Categories

Resources