Statusbar not getting transparent instead getting milky color












0














I have implemented the following code for getting the transparent status bar but not able to
Kindly help me.
If fitSystemWindows is true then status bar not getting transparent and if fitSystemWindows is false to rootlayout then content is going below navigation bar.
I have applied following code before setting content view on my activty.



@TargetApi(Build.VERSION_CODES.LOLLIPOP)
public static void setFullTheme(Activity activity){
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
Window window = activity.getWindow();
window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
window.setStatusBarColor(Color.TRANSPARENT);
}
}


This is the theme I have applied to the activity



<style name="ThemeFullScreen" parent="Theme.AppCompat.Light.NoActionBar">
<item name="colorPrimary">@color/colorPrimary</item>
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
<item name="colorAccent">@color/colorAccent</item>
<item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent
</item>
<item name="android:windowEnableSplitTouch">false</item>
<item name="android:windowDrawsSystemBarBackgrounds">true</item>
<item name="android:windowTranslucentStatus" tools:targetApi="kitkat">true</item>
<item name="android:windowTranslucentNavigation">true</item>
</style>


By implementing these the status bar got transparent but navigation bar too got transluscent and hence the content was going behind the navigation bar.
So I applied android:fitSystemWindows="true" to the root view but after that status bar got milky color.



<android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_container_home"
android:layout_width="match_parent"
android:layout_height="match_parent">


<FrameLayout
android:id="@+id/main_frag_home"
android:fitsSystemWindows="true"
android:layout_width="match_parent"
android:layout_height="match_parent">

<FrameLayout
android:id="@+id/content_member_profile"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingBottom="?attr/actionBarSize">

</FrameLayout>

<com.aurelhubert.ahbottomnavigation.AHBottomNavigation
android:id="@+id/bottom_navigation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom" />
</FrameLayout>




Following picture,when I set true to fitSystemWindows in root layout. Content goes behind navigation bar.



Following picture,when I remove the fitSystemWindows property in root layout. Status bar color goes white.










share|improve this question





























    0














    I have implemented the following code for getting the transparent status bar but not able to
    Kindly help me.
    If fitSystemWindows is true then status bar not getting transparent and if fitSystemWindows is false to rootlayout then content is going below navigation bar.
    I have applied following code before setting content view on my activty.



    @TargetApi(Build.VERSION_CODES.LOLLIPOP)
    public static void setFullTheme(Activity activity){
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
    Window window = activity.getWindow();
    window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
    window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
    window.setStatusBarColor(Color.TRANSPARENT);
    }
    }


    This is the theme I have applied to the activity



    <style name="ThemeFullScreen" parent="Theme.AppCompat.Light.NoActionBar">
    <item name="colorPrimary">@color/colorPrimary</item>
    <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
    <item name="colorAccent">@color/colorAccent</item>
    <item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent
    </item>
    <item name="android:windowEnableSplitTouch">false</item>
    <item name="android:windowDrawsSystemBarBackgrounds">true</item>
    <item name="android:windowTranslucentStatus" tools:targetApi="kitkat">true</item>
    <item name="android:windowTranslucentNavigation">true</item>
    </style>


    By implementing these the status bar got transparent but navigation bar too got transluscent and hence the content was going behind the navigation bar.
    So I applied android:fitSystemWindows="true" to the root view but after that status bar got milky color.



    <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/main_container_home"
    android:layout_width="match_parent"
    android:layout_height="match_parent">


    <FrameLayout
    android:id="@+id/main_frag_home"
    android:fitsSystemWindows="true"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <FrameLayout
    android:id="@+id/content_member_profile"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:paddingBottom="?attr/actionBarSize">

    </FrameLayout>

    <com.aurelhubert.ahbottomnavigation.AHBottomNavigation
    android:id="@+id/bottom_navigation"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="bottom" />
    </FrameLayout>




    Following picture,when I set true to fitSystemWindows in root layout. Content goes behind navigation bar.



    Following picture,when I remove the fitSystemWindows property in root layout. Status bar color goes white.










    share|improve this question



























      0












      0








      0







      I have implemented the following code for getting the transparent status bar but not able to
      Kindly help me.
      If fitSystemWindows is true then status bar not getting transparent and if fitSystemWindows is false to rootlayout then content is going below navigation bar.
      I have applied following code before setting content view on my activty.



      @TargetApi(Build.VERSION_CODES.LOLLIPOP)
      public static void setFullTheme(Activity activity){
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      Window window = activity.getWindow();
      window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
      window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
      window.setStatusBarColor(Color.TRANSPARENT);
      }
      }


      This is the theme I have applied to the activity



      <style name="ThemeFullScreen" parent="Theme.AppCompat.Light.NoActionBar">
      <item name="colorPrimary">@color/colorPrimary</item>
      <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
      <item name="colorAccent">@color/colorAccent</item>
      <item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent
      </item>
      <item name="android:windowEnableSplitTouch">false</item>
      <item name="android:windowDrawsSystemBarBackgrounds">true</item>
      <item name="android:windowTranslucentStatus" tools:targetApi="kitkat">true</item>
      <item name="android:windowTranslucentNavigation">true</item>
      </style>


      By implementing these the status bar got transparent but navigation bar too got transluscent and hence the content was going behind the navigation bar.
      So I applied android:fitSystemWindows="true" to the root view but after that status bar got milky color.



      <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/main_container_home"
      android:layout_width="match_parent"
      android:layout_height="match_parent">


      <FrameLayout
      android:id="@+id/main_frag_home"
      android:fitsSystemWindows="true"
      android:layout_width="match_parent"
      android:layout_height="match_parent">

      <FrameLayout
      android:id="@+id/content_member_profile"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="?attr/actionBarSize">

      </FrameLayout>

      <com.aurelhubert.ahbottomnavigation.AHBottomNavigation
      android:id="@+id/bottom_navigation"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="bottom" />
      </FrameLayout>




      Following picture,when I set true to fitSystemWindows in root layout. Content goes behind navigation bar.



      Following picture,when I remove the fitSystemWindows property in root layout. Status bar color goes white.










      share|improve this question















      I have implemented the following code for getting the transparent status bar but not able to
      Kindly help me.
      If fitSystemWindows is true then status bar not getting transparent and if fitSystemWindows is false to rootlayout then content is going below navigation bar.
      I have applied following code before setting content view on my activty.



      @TargetApi(Build.VERSION_CODES.LOLLIPOP)
      public static void setFullTheme(Activity activity){
      if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
      Window window = activity.getWindow();
      window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
      window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
      window.setStatusBarColor(Color.TRANSPARENT);
      }
      }


      This is the theme I have applied to the activity



      <style name="ThemeFullScreen" parent="Theme.AppCompat.Light.NoActionBar">
      <item name="colorPrimary">@color/colorPrimary</item>
      <item name="colorPrimaryDark">@color/colorPrimaryDark</item>
      <item name="colorAccent">@color/colorAccent</item>
      <item name="android:statusBarColor" tools:targetApi="lollipop">@android:color/transparent
      </item>
      <item name="android:windowEnableSplitTouch">false</item>
      <item name="android:windowDrawsSystemBarBackgrounds">true</item>
      <item name="android:windowTranslucentStatus" tools:targetApi="kitkat">true</item>
      <item name="android:windowTranslucentNavigation">true</item>
      </style>


      By implementing these the status bar got transparent but navigation bar too got transluscent and hence the content was going behind the navigation bar.
      So I applied android:fitSystemWindows="true" to the root view but after that status bar got milky color.



      <android.support.design.widget.CoordinatorLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/main_container_home"
      android:layout_width="match_parent"
      android:layout_height="match_parent">


      <FrameLayout
      android:id="@+id/main_frag_home"
      android:fitsSystemWindows="true"
      android:layout_width="match_parent"
      android:layout_height="match_parent">

      <FrameLayout
      android:id="@+id/content_member_profile"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingBottom="?attr/actionBarSize">

      </FrameLayout>

      <com.aurelhubert.ahbottomnavigation.AHBottomNavigation
      android:id="@+id/bottom_navigation"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_gravity="bottom" />
      </FrameLayout>




      Following picture,when I set true to fitSystemWindows in root layout. Content goes behind navigation bar.



      Following picture,when I remove the fitSystemWindows property in root layout. Status bar color goes white.







      java android xml android-layout






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 28 '18 at 10:33







      VinayakPurohit

















      asked Nov 18 '18 at 8:19









      VinayakPurohitVinayakPurohit

      156




      156
























          1 Answer
          1






          active

          oldest

          votes


















          0














          put android:fitSystemWindows="true" again and change android:windowDrawsSystemBarBackgrounds attribute in your theme as false



          nevigate to this https://developer.android.com/reference/android/R.attr documentation and you can find out




          The window must be drawing the system bar backgrounds with
          windowDrawsSystemBarBackgrounds and the navigation bar must not have
          been requested to be translucent with windowTranslucentNavigation.
          Corresponds to Window.setNavigationBarColor(int).







          share|improve this answer























          • Thank You for your reply. But it didn't worked out .
            – VinayakPurohit
            Nov 18 '18 at 20:02










          • Is that same issue yoiu got ?
            – Lucefer
            Nov 19 '18 at 3:00










          • Yes. Getting the status bar color as white as shown in the image above.
            – VinayakPurohit
            Nov 19 '18 at 8:09











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53359045%2fstatusbar-not-getting-transparent-instead-getting-milky-color%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          0














          put android:fitSystemWindows="true" again and change android:windowDrawsSystemBarBackgrounds attribute in your theme as false



          nevigate to this https://developer.android.com/reference/android/R.attr documentation and you can find out




          The window must be drawing the system bar backgrounds with
          windowDrawsSystemBarBackgrounds and the navigation bar must not have
          been requested to be translucent with windowTranslucentNavigation.
          Corresponds to Window.setNavigationBarColor(int).







          share|improve this answer























          • Thank You for your reply. But it didn't worked out .
            – VinayakPurohit
            Nov 18 '18 at 20:02










          • Is that same issue yoiu got ?
            – Lucefer
            Nov 19 '18 at 3:00










          • Yes. Getting the status bar color as white as shown in the image above.
            – VinayakPurohit
            Nov 19 '18 at 8:09
















          0














          put android:fitSystemWindows="true" again and change android:windowDrawsSystemBarBackgrounds attribute in your theme as false



          nevigate to this https://developer.android.com/reference/android/R.attr documentation and you can find out




          The window must be drawing the system bar backgrounds with
          windowDrawsSystemBarBackgrounds and the navigation bar must not have
          been requested to be translucent with windowTranslucentNavigation.
          Corresponds to Window.setNavigationBarColor(int).







          share|improve this answer























          • Thank You for your reply. But it didn't worked out .
            – VinayakPurohit
            Nov 18 '18 at 20:02










          • Is that same issue yoiu got ?
            – Lucefer
            Nov 19 '18 at 3:00










          • Yes. Getting the status bar color as white as shown in the image above.
            – VinayakPurohit
            Nov 19 '18 at 8:09














          0












          0








          0






          put android:fitSystemWindows="true" again and change android:windowDrawsSystemBarBackgrounds attribute in your theme as false



          nevigate to this https://developer.android.com/reference/android/R.attr documentation and you can find out




          The window must be drawing the system bar backgrounds with
          windowDrawsSystemBarBackgrounds and the navigation bar must not have
          been requested to be translucent with windowTranslucentNavigation.
          Corresponds to Window.setNavigationBarColor(int).







          share|improve this answer














          put android:fitSystemWindows="true" again and change android:windowDrawsSystemBarBackgrounds attribute in your theme as false



          nevigate to this https://developer.android.com/reference/android/R.attr documentation and you can find out




          The window must be drawing the system bar backgrounds with
          windowDrawsSystemBarBackgrounds and the navigation bar must not have
          been requested to be translucent with windowTranslucentNavigation.
          Corresponds to Window.setNavigationBarColor(int).








          share|improve this answer














          share|improve this answer



          share|improve this answer








          edited Nov 18 '18 at 13:20

























          answered Nov 18 '18 at 13:04









          LuceferLucefer

          1,1061511




          1,1061511












          • Thank You for your reply. But it didn't worked out .
            – VinayakPurohit
            Nov 18 '18 at 20:02










          • Is that same issue yoiu got ?
            – Lucefer
            Nov 19 '18 at 3:00










          • Yes. Getting the status bar color as white as shown in the image above.
            – VinayakPurohit
            Nov 19 '18 at 8:09


















          • Thank You for your reply. But it didn't worked out .
            – VinayakPurohit
            Nov 18 '18 at 20:02










          • Is that same issue yoiu got ?
            – Lucefer
            Nov 19 '18 at 3:00










          • Yes. Getting the status bar color as white as shown in the image above.
            – VinayakPurohit
            Nov 19 '18 at 8:09
















          Thank You for your reply. But it didn't worked out .
          – VinayakPurohit
          Nov 18 '18 at 20:02




          Thank You for your reply. But it didn't worked out .
          – VinayakPurohit
          Nov 18 '18 at 20:02












          Is that same issue yoiu got ?
          – Lucefer
          Nov 19 '18 at 3:00




          Is that same issue yoiu got ?
          – Lucefer
          Nov 19 '18 at 3:00












          Yes. Getting the status bar color as white as shown in the image above.
          – VinayakPurohit
          Nov 19 '18 at 8:09




          Yes. Getting the status bar color as white as shown in the image above.
          – VinayakPurohit
          Nov 19 '18 at 8:09


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53359045%2fstatusbar-not-getting-transparent-instead-getting-milky-color%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to change which sound is reproduced for terminal bell?

          Title Spacing in Bjornstrup Chapter, Removing Chapter Number From Contents

          Can I use Tabulator js library in my java Spring + Thymeleaf project?