How to change the color of the status-bar in android studio for single activity

How to change the color of the status-bar in android studio for a single activity

If you are an android developer.  But you don't know how to change the color of the status bar color for single activity then I can help you. no need to open more tabs and read typical blogs so let's talk about



Most of the time when we develop an app we have to create the splash screen and in this splash screen,
we have to remove the status bar color and we have to match its color with our activity color there we can use this simple technique to change the color.

how to change the color of the status bar in android studio for a single activity. jus follow these simple steps and you will see that your problem will be solved.
Steps:-
       
  • Open that java file of that activity in which you want to hide the status bar.
  • Type the code before this line of code that is
  •  setContentView(R.layout.activity_splash_photoeditor);
  • Just paste this code as it looks like, The Code is 

 Code :

 Window window = this.getWindow();

window.setStatusBarColor(this.getResources().getColor(R.color.White));

Where I  wite the R.color.White, You can select the color from the color resource file.
 if You want to change the color of the status bar of the full application simply you can change the theme of the application in the color.xml file in Android Studio.


It is disappeared. I am 100% sure it will work but if you are facing any kind of issue you can comment to me I will reply as soon as possible.




Post a Comment

1 Comments