Reputation: 179
I have managed to get a fully transparent status bar but I would like a semi-transparent one instead. Below is the code I added to achieve a fully transparent status bar.
In my styles.xml I added the following:
<item name="android:windowTranslucentStatus">true</item>
<item name="android:windowTranslucentNavigation">true</item>
In my activity.xml:
android:fitsSystemWindows="true"
In the onCreate of my activity.java:
getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
This is what I would like to achieve:
Upvotes: 0
Views: 286
Reputation: 793
There can be multiple possible solutions for your problem :
1. Switch to fullscreen window
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
2. The XML way
<style name="AppTheme.MainActivity" parent="AppTheme">
<item name="colorPrimary">#ffffff</item>
<item name="colorPrimaryDark">#ebebeb</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="windowActionBar">false</item>
<item name="android:windowTranslucentStatus">true</item>
<item name="windowNoTitle">true</item>
</style>
Upvotes: 1
Reputation: 7868
Here is some option that you can implement on your code,
Option 1: On your xml file
android:background ="#88676767" or "#88000000"
Option 2. On your image view or any other view
view.setColorFilter(Color.argb(150, 155, 155, 155), Mode.SRC_ATOP);
Option 3: On your layout
LinearLayout ll = (LinearLayout) findViewById(R.id.test_layout);
Drawable dd = getResources().getDrawable(R.drawable.test);
dd.setAlpha(50);
ll.setBackgroundDrawable(dd);
It might be helpful for you.
Upvotes: 0
Reputation: 34
create new color inside colors.xml
<color name="blackT">#88000000</color>
then inside style.xml change primary dark color
<item name="colorPrimaryDark">@color/blackT</item>
Upvotes: 0