android status bar can not be transparent?

mc 4,636 Reputation points
2021-04-27T02:50:05.847+00:00

If I set this in styls.xml

<item name="android:statusBarColor">#00000000</item>  
    <item name="android:windowTranslucentNavigation">false</item>  
    <item name="android:windowLightStatusBar">true</item>  

then it is like this:

91476-image.png

there will be an alpha.

if set like this:

<item name="android:statusBarColor">#00000000</item>  
    <item name="android:windowTranslucentStatus">false</item>  
    <item name="android:windowTranslucentNavigation">false</item>  
    <item name="android:windowLightStatusBar">true</item>  

it will be :
91585-image.png

and I do not set this color and do not know why it is this color.

how to make the status bar be opacity=0?

Xamarin
Xamarin
A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,362 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. JessieZhang-MSFT 7,711 Reputation points Microsoft Vendor
    2021-04-27T07:19:34.117+00:00

    Hello,

    Welcome to our Microsoft Q&A platform!

    You can try the following code:

    <item name="android:statusBarColor">@android:color/transparent</item>  
    <item name="android:windowTranslucentStatus">true</item>  
    <item name="android:fitsSystemWindows">true</item>  
    

    The result is:
    91604-image.png

    Note: The background's color of the status bar is the color of current activity 's background.

    Best Regards,

    Jessie Zhang


    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.