Android Chinese API (90) -- WindowManager

Source: Internet
Author: User

 

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 ");
}
}

 

Related Article

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.