In my application, I want to override the color of ActionBar
and make it translucent. (color hex #40000000)
I'm also using a background image in my Activity.
Issue is the ActionBar not taking the background image as its part. That is the image is starting below the action bar. (as you can see in the screenshot below)
It seems the bacground color of ActionBar is white and the translucent color is rendered over it.
Another issue is, I'm also displaying a view just below to action bar. (See image below)
The height of this view is same as the height of Action bar. Fo this I'm using below code in my onCreate()
private void setTopPanelHeight() {
// Calculating ActionBar height
TypedValue tv = new TypedValue();
if (getTheme().resolveAttribute(android.R.attr.actionBarSize, tv, true)) {
// Height in pixels.
Integer actionBarHeight = TypedValue.complexToDimensionPixelSize(tv.data, getResources().getDisplayMetrics());
// Changing panel height.
View panelView = findViewById(R.id.view_panel_below_action_bar);
FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) panelView.getLayoutParams();
params.height = (int) actionBarHeight;
panelView.setLayoutParams(params);
}
}
<<
As suggested in many answers & in android docs, I tried to use:
<item name="android:windowActionBarOverlay">true</item>
And then increased my layout top-margin as suggested here
`android:layout_marginTop="?android:attr/actionBarSize"`
But, no use.
How can I make my background image included in the ActionBar & also do not disturb my view_below_actionbar & navigation drawer
.
Thank You