Hide the title bar and status bar of an Android app
In order to beautify the interface of the program, we hope to hide the TitleBar of the application. The commands found on the Internet have a good effect. The second method is recommended, which is clear at a glance.
Method 1: Add the following code in onCreate
This article describes the Android programming implementation to get the title bar, status bar height, screen size, and simulate the home key method. Share to everyone for your reference, specific as follows:
1. Get the title bar height:
/**
* Get the height of the
This article mainly introduces the Android implementation of the hidden status bar and the title bar of the relevant information, the need for friends can refer to the
To hide the title bar you need to use a predefined style: Android:theme= "@
Android get custom control position coordinates, screen size, title bar, status bar height1. Get the custom control heightIn this activity, get the height of the control in the current activity:Button button = (button) Findviewbyid (R.id.button), int buttonheight = Button.getheight ();Gets the height of the control in
Http://www.cnblogs.com/zhuguangwei/archive/2011/01/18/1938276.htmlFirst, hide the title barHide title barThis.requestwindowfeature (Window.feature_no_title);Second, hide the status barHide the status barThis.getwindow (). SetFlags (WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_ fullscreen);Third, remove the title bar of all activity
Android gets the height of the status bar (StatusBar) and the navigation bar at the top of the system, androidstatusbar
Android devices have two upper and lower bars. We can obtain the bar information. The code for obtaining the
The following describes how to obtain screen-related information in Android.
1. screen size, source code:
Displaymetrics metrics = new displaymetrics (); getwindowmanager (). getdefadisplay display (). getmetrics (metrics); int screenwidth = metrics. widthpixels; // screen width int screenheight = metrics. heightpixels; // screen height
This code can be inserted into the oncreate () function of the activity.
2. Get the system @ hide attribute using
@Override public void Onwindowfocuschanged (Boolean hasfocus) { super.onwindowfocuschanged (hasfocus); Rect frame = new Rect (); GetWindow (). Getdecorview (). Getwindowvisibledisplayframe (frame); int statusbarheight = frame.top; Gets the title Bar height window window = GetWindow (); int contentviewtop = GetWindow () . Findviewbyid (window.id_android_content). Get
first, ahead
In the study of "Android similar to the 360,qq Butler Suspension window" whim, want to apply the icon also displayed to the status bar, similar to mobile phone QQ, and when the message to change the status bar icon display.
Second, the principle
In fact, aft
1. Hide the title bar
Copy codeThe Code is as follows: // hide the title bar this. requestWindowFeature (Window. FEATURE_NO_TITLE );
Ii. Hide the status barCopy codeThe Code is as follows: // hide the status bar this. getWindow (). setFlags (WindowManager. LayoutParams. FL
To hide the title bar you need to use a predefined style: Android:theme= "@android: Style/theme.notitlebar".Hide status bar: Android:theme= "@android: Style/theme.notitlebar.fullscreen".
@Override public
void OnCreate (Bundle savedinstancestate) {
First, hide the title bar
Copy Code code as follows:
Hide title bar this.requestwindowfeature (Window.feature_no_title);
Second, hide the status bar
Copy Code code as follows:
Hides the status bar This.get
Objective:
Before entering today's topic, or the old way to talk about feeling it, recently feel the whole lost sense of direction, good confused! Looking for a job has failed again, is Android really saturated? These two days I have not gone out, in addition to go downstairs to sell is curtilage dormitory, static thought for a long time, I still can't forget beginner's mind, I believe I can not find a job for many reasons, the most important thing i
In Android applications, it is sometimes necessary to calculate the location of a view, resulting in the need to calculate status bar height, title bar height and other information. For the convenience of the future, make a simple record here.Before drying the code, understand the division of the
(Build.VERSION.SDK_INT >= build.version_codes.
KitKat) {window window = Context.getwindow (); Window.setflags (WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_TRANSLUCENT
_status);
int statusbarheight = Getstatusbarheight (Context.getbasecontext ());
View.setpadding (0, statusbarheight, 0, 0); }/** * is used to get the height of the status bar.
Use the Res
is still visible, activity, the top layout will be covered by the state.View.system_ui_flag_layout_hide_navigation: Effect with View.system_ui_flag_layout_fullscreenView.system_ui_layout_flags: Effect with View.system_ui_flag_layout_fullscreenView.system_ui_flag_hide_navigation: Hides the virtual keys (navigation bar). Some phones use virtual buttons instead of physical buttons.View.system_ui_flag_low_profile: St
Xiao bin want to do anything Ningchong cause far attention 2016.06.30 10:16* words 489 read 3234 comments 3 likes ObjectiveBecause the damned undead design is wet, a set of white status bar UI is designed. Of course, on iOS can be adaptive, but Android is more troublesome, so has not been engaged. Recently saw an article on the White bottom black word!
This article illustrates how Android effectively gets the status bar (StatusBar) height. Share to everyone for your reference, specific as follows:
Encountered a problem needing to get the status bar height.
Like the late version of An
I. Overview
Now most of the app's details pages are pretty much the same, almost all of the above is a picture of a product, when you slide, there will be a tab suspended on the top, so that the user experience is really good, if the tab slide up, users may also need to slide down, in order to click tab, this is really troublesome. Immersion status bar that, Guo Lin said Google did not give an immersive
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.