The Status Bar that shows the number of pages, number of words and number of characters has disappeared. I have tried right clicking it to see if it will reappear but it doesn't. I am in the Print Layout and it still isn't there. The toolbar at the top of the Mac OS X Snow Leopard screen gives you one-click access to many basic tasks. You can customize the icons that appear on Mac’s toolbar to facilitate your work style and preferences.

I'd like to integrate something like this:
And I've done it like this, but I can't seem to put the imageview below the toolbar. Without the toolbar, I can make it under the status bar, but combining these two are impossible.
Here's my layout:
In my activity, I've done the following:
I've also declared an styles-v21.xml file:
And set it as default style for PhotoActivity.I've already tried putting the toolbar in a FrameLayout, but doing that my toolbar simply hides, like this:
Thanks in advance.
Got that fixed, but toolbar is overlapping the status bar. Is there anyway to fix the padding? If I use android:fitsSystemWindows='true', status bar isn't translucent anymore.
8 Answers
I would remove the Toolbar
from your layout and use an implementation of an ActionBar
from the AppCompat.Theme
:
Then, I would create a new style for the semi-transparent ActionBar
(in values/styles.xml
:
And in v21/styles.xml
:
/SafariToolbarLifewire-5821f8053df78cc2e81f5c02.jpg)
I assume, that your Activity
extends AppCompatActivity
so then in onCreate()
you can call:
For enabling a back button:
For setting your translucent color:
For removing your ActionBar
title:
What is more, I would change your root LinearLayout
to CoordinatorLayout
as it gives you more control over your layouts (it's a more powerful FrameLayout
).
The color which I used is:
Of course you should remember to apply this theme to your Activity
in the AndroidManifest.xml
:
By doing all these steps you should get something like this:
Please let me know, if it works for you.
mmBsmmBsAs you said,
'I've already tried putting the toolbar in a FrameLayout, but doing that my toolbar simply hides, like this:'.
The problem with this is the order of adding childView in FrameLayout
, you added Toolbar as first child and after that you added ImageView. this is why image hides the toolbar. Instead, the order of views inside FameLayout
should be like this
Also for API level >=19 ,you can add this attribute in style.xml
file to make statusBar transparent<item name='android:windowTranslucentStatus'>true</item>
For making content behind statusBar use this link
https://developer.android.com/training/system-ui/status.html#behind
LinearLayout
will automatically place the ImageView
below the Toolbar
.
Try using a RelativeLayout
instead.
Dont treat status bar as something separate from your app. Image is coming below the toolbar because you have used LinearLayout. Had you used RelativeLayout, your image would be starting at the same height as toolbar.
Now for making the statusbar transparent and for everything to start from under the statusbar use the following.
Use the above style for your activity and everything starts from under the statusbar. Now for the toolbar, you can increase the height of the toolbar by adding the height of the statusbar as padding to toolbar. This can be done as follows:
You can set a color to statusbar and use the same color with AlphaTransparency on Toolbar.
Find Status Bar
Now you control everything including the statusbar and the toolbar.
RoadblockRoadblockTLDR; You have to wrap the toolbar in a LinearLayout.
What I did to make it work was similar to @Akhilesh Kumar's approach but I wrapped the toolbar in a LinearLayout which fixed the toolbar overlapping. I also put the fitsSystemWindows to true in that LinearLayout.
I hope it helps.
Got that fixed, but toolbar is overlapping the status bar. Is there anyway to fix the padding? If I use android:fitsSystemWindows='true', status bar isn't translucent anymore.
Where Is My Status Bar
I've recently written a post about WindowInsets, you may check it out. I think it would resolve your issue.
Long story short - what you have to do is to pass window insets only to Toolbar
via ViewCompat.setOnApplyWindowInsetListener
API. But the parent of your Toolbar
should pass the window insets. In your case that won't happen, because by default LinearLayout
and family layouts won't do that, you have to subclass and override onApplyWindowInsets
method.
Help Panel
I suggest you to read the article, where everything is described more precisely.
azizbekianazizbekian