Read about android fully transparent status bar, The latest news, videos, and discussion topics about android fully transparent status bar from alibabacloud.com
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
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
2. Hide the title bar// Call this method before Activity. setCurrentView ();Private void HideTitle (){RequestWindowFeature (Window. FEATURE_NO_TITLE );}OrRequestWindowFeature (Window. FEATURE_NO_TITLE); // The title is not displayed on the page.2. Hide the status bar (full screen) www.2cto.com// Call this method before Activity. setCurrentView ();Private void Hid
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
This feature is andorid4.4 support, at least api19 can be used, that is, if the Android machine is less than 4.4, immersion notification bar is ineffective. Here is a brief introduction to the method used.
/**
* Set the notification bar This method is implemented in OnCreate (), if it is added in the parent class's OnCreate (), even if all inherited t
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
@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
This feature is andorid4.4 support, at least api19 can be used, that is, if Android is less than 4.4, the immersion notification bar is not effective. Here's how it's done, it's very simple./*** Set the notification bar This method is implemented in OnCreate (), if it is added in the parent class's OnCreate (), even if all inherited from the parent class will hav
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) {
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
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
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
In the development of Android projects, sometimes in order to achieve better interaction with the user, in the notice bar this small corner, we usually need to enrich the content, this time we need to implement their own definition of the notification bar, such as the following 360 or NetEase style:The first thing we need to understand is that we define the type
layout:Same as the top layout.Achieve true full screen display, picture under status barTo implement a picture that can be displayed under the status bar, such as an effect, you need to make the status bar Transparent, The second
I would like to write one, but after seeing this, I would like to turn over, it is very detailed:
In the Android system, it is convenient to send a status bar notification. Let's take a look at, how to send status bar notification, stat
Today summed up the status bar color settings, common to have a fixed color or immersion implementation, nonsense not to say, directly above the figure.
Standard:
Fixed color:
Immersion type:
My personal latest immersive implementation,
bar height is 24DP, insurance or need to read the system's configuration height, as well as the settings padding sometimes fail, you need handler.post(new Runnable()) to ensure code execution
Read the system configuration status bar height code: /** * 19API above reading to the status
is not valid.
Code control, can solve the problem of fragment. But determine the status bar height is a bit troublesome, in general, the status bar height is 24DP, insurance or need to read the system's configuration height, there are settings padding sometimes will fail, it is necessary handler.post(new Runnable(
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.