Issue
I want to hide the title bar using code for some of my activities.
I have used the following code
this.requestWindowFeature(Window.FEATURE_NO_TITLE);
//Remove notification bar
this.getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
the second line is working for full screen but it shows the application title. Lets say for my splash screen i want to hide my title. The 1st line of code crashes my application. Please help me if we can do it using code.
thanks.
Solution
To hide title bar and status bar:
try
{((View)act.findViewById(android.R.id.title).getParent()).setVisibility(View.GONE);
}
catch (Exception e) {}
act.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
act.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
view.requestLayout();
To show title bar and status bar:
try
{((View)act.findViewById(android.R.id.title).getParent()).setVisibility(View.VISIBLE);
}
catch (Exception e) {}
act.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
act.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
view.requestLayout();
Answered By - diyism
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.