Preface
This chapter is about android. view. WindowManager. The version is Android 2.3 r1 and translated from "". You are welcome to visit his blog: http://t.qq.com/pansonphy. thank you again for ""! I look forward to you join the Android Chinese translation group, contact my over140@gmail.com.
Statement
You are welcome to repost, but please keep the original source of the article :)
Blog Garden: http://www.cnblogs.com/
Android Chinese translation group: http://goo.gl/6vJQl
Body
I. Structure
Public interface WindowManager extends android. view. ViewManager
Android. view. WindowManager
Ii. Overview
This interface is used to interact with the window manager. PassContext.getSystemService(Context.WINDOW_SERVICE)
You can obtain the WindowManager instance. (Translator's note: for example, WindowManager wm = (WindowManager) context. getSystemService (Context. WINDOW_SERVICE );)
See
getSystemService(String)
WINDOW_SERVICE
Iii. Internal class
Public static classWindowManager. LayoutParams
(Note: inherited from android. view. ViewGroup. LayoutParams)
Public static classWindowManager. BadTokenException
When a view is added, if the WindowManager. LayoutParams token (token) of the view is invalid, the exception is thrown.
Iv. Public Methods
Public abstract DisplayGetdefadisplay display()
Get the default display object
Return Value
Default Display object
Public abstract voidRemoveViewImmediate(View view)
Is a special extension of removeView (View). The View. onDetachedFromWindow () method at the View level can be called immediately before the method is returned. It is not applicable to general programs. If you want to use it correctly, you need to be especially careful.
Parameters
View to be removed
5. Supplement
Article Link
WindowManagerDemo
Sample Code (Code from the article link) Public class WindowManagerDemo extends Activity {
/** Called when the activity is first created .*/
@ Override
Public void onCreate (Bundle savedInstanceState ){
Super. onCreate (savedInstanceState );
SetContentView (R. layout. main );
TextView textView = (TextView) findViewById (R. id. label );
WindowManager windowManager = (WindowManager)
GetSystemService (Context. WINDOW_SERVICE );
// Print the current window's width and height on the title, eg: 320*480
SetTitle (windowManager. getdefadisplay display (). getWidth () + "*"
+ WindowManager. getdefadisplay display (). getHeight ());
TextView. setText ("See the Title ");
}
}