java.lang.Object | |
↳ | android.view.Window |
Abstract base class for a top-level window look and behavior policy. An instance of this class should be used as the top-level view added to the window manager. It provides standard UI policies such as a background, title area, default key processing, etc.html
The only existing implementation of this abstract class is android.policy.PhoneWindow, which you should instantiate when needing a Window. Eventually that class will be refactored and a factory method added for creating Window instances without knowing about a particular implementationjava
window是一個抽象基類,負責頂層窗口顯示和行爲的規則。這個類的一個實例必須被用做頂層的view加入到window manager中。它提供了標準UI規則,例如:背景,標題區域,默認的主進程等等。android
這個抽象類的僅有的一個實現是android.policy.PhoneWindow。當你須要一個窗口window的時候,你須要實例化PhoneWindow。最後,PhoneWindow這個類會使用你不須要知道的特殊實現方式的重構方法進行重構,從而獲得一個PhoneWindow對象,也即獲得一個窗口。web
Nested Classes內部類 | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
interface編程 接口windows |
回調類app |
API from a Window back to its caller. 框架 應用程序編程接口:從窗口window到它的調用者ide |
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
int | DEFAULT_FEATURES窗口默認特徵 | The default features enabled 啓用 | |||||||||
int | FEATURE_ACTION_BAR | Flag for enabling the Action Bar. | |||||||||
int | FEATURE_ACTION_BAR_OVERLAY | Flag for requesting an Action Bar that overlays window content. | |||||||||
int | FEATURE_ACTION_MODE_OVERLAY | Flag for specifying the behavior of action modes when an Action Bar is not present. | |||||||||
int | FEATURE_CONTEXT_MENU上下文菜單 | Flag for the context menu. | |||||||||
int | FEATURE_CUSTOM_TITLE自定義標題 | Flag for custom title. | |||||||||
int | FEATURE_INDETERMINATE_PROGRESS不肯定的進度條 | Flag for indeterminate progress | |||||||||
int | FEATURE_LEFT_ICON標題區域的左圖標 | Flag for having an icon on the left side of the title bar | |||||||||
int | FEATURE_NO_TITLE無標題 | Flag for the "no title" feature, turning off the title at the top of the screen. | |||||||||
int | FEATURE_OPTIONS_PANEL選項面板 | Flag for the "options panel" feature. | |||||||||
int | FEATURE_PROGRESS指示器進度條 | Flag for the progress indicator feature | |||||||||
int | FEATURE_RIGHT_ICON標題區域的右圖標 | Flag for having an icon on the right side of the title bar | |||||||||
int | ID_ANDROID_CONTENT佈局Layout的ID | The ID that the main layout in the XML layout file should have. | |||||||||
int | PROGRESS_END進度條的結束值 | Ending value for the (primary) progress | |||||||||
int | PROGRESS_INDETERMINATE_OFF關閉不肯定的進度條 | Flag for setting the progress bar's indeterminate mode off | |||||||||
int | PROGRESS_INDETERMINATE_ON開啓不肯定的進度條 |
Flag for setting the progress bar's indeterminate mode on | |||||||||
int | PROGRESS_SECONDARY_END第二進度條的最高可能值 | Highest possible value for the secondary progress | |||||||||
int | PROGRESS_SECONDARY_START第二進度條的最低可能值 | Lowest possible value for the secondary progress | |||||||||
int | PROGRESS_START進度條起始值 | Starting value for the (primary) progress | |||||||||
int | PROGRESS_VISIBILITY_OFF進度條不可見 | Flag for setting the progress bar's visibility to GONE | |||||||||
int | PROGRESS_VISIBILITY_ON進度條可見 | Flag for setting the progress bar's visibility to VISIBLE |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Window(Context context)構造方法 |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract void | addContentView(View view, ViewGroup.LayoutParams params)
加Variation on
setContentView(View, android.view.ViewGroup.LayoutParams)
to add an additional content view to the screen.爲window添加view,而且指定佈局
|
||||||||||
void | addFlags(int flags) 爲window添加特定的特徵。
Convenience function to set the flag bits as specified in flags, as per
setFlags(int, int) .
|
||||||||||
void | clearFlags(int flags) 清除window的某一特徵
Convenience function to clear the flag bits as specified in flags, as per
setFlags(int, int) .
|
||||||||||
abstract void | closeAllPanels()關閉全部嵌入的面板 | ||||||||||
abstract void | closePanel(int featureId)關閉某一個指定的嵌入面板 | ||||||||||
View | findViewById(int id) 經過id獲取view。經過onCreate方法中處理的xml文件中標識View的 id,獲取view。
Finds a view that was identified by the id attribute from the XML that was processed in
onCreate(Bundle) .
|
||||||||||
final WindowManager.LayoutParams | 獲取當前窗口與這個面板相關的屬性(佈局信息)。
Retrieve the current window attributes associated with this panel.
|
||||||||||
final Window.Callback | 獲取這個窗口的回調接口。
Return the current Callback interface for this window.
|
||||||||||
final Window | 獲取這個窗口的容器(仍是一個窗口)
Return the container for this Window.
|
||||||||||
final Context | 獲取這個正在運行的窗口的上下文信息,從而能夠從這些信息中獲取到資源和其餘的信息。
Return the Context this window policy is running in, for retrieving resources and other information.
|
||||||||||
abstract View | 獲取當前窗口中當前獲得焦點的view。若是沒有任何view獲得焦點,則返回空。
Return the view in this Window that currently has focus, or null if there are none.
|
||||||||||
abstract View | 得到修飾view。得到頂層窗口的修飾view(包括標準窗口框架結構,修飾和窗口中的內容)。這個修飾view能夠被看成一個window加入到window manager中。
Retrieve the top-level window decor view (containing the standard window frame/decorations and the client's content inside of that), which can be added as a window to the window manager.
|
||||||||||
abstract LayoutInflater | 得到LayoutInflater實例。這個實例是從窗口從本身的上下文信息中獲得的。 |
||||||||||
abstract int | getVolumeControlStream()得到音量控制流 | ||||||||||
WindowManager | 得到這個window的窗口管理器window manager。window manager 容許這個window顯示它的windows。
Return the window manager allowing this Window to display its own windows.
|
||||||||||
final TypedArray | 得到窗口主題的窗口屬性。 |
||||||||||
final boolean | hasChildren()有子孩子 | ||||||||||
boolean | hasFeature(int feature) 查詢是否有某一個特定的特徵
Query for the availability of a certain feature.
|
||||||||||
void | injectInputEvent(InputEvent event) 爲窗口註冊一個本地輸入事件
Inject an event to window locally.
|
||||||||||
abstract void | invalidatePanelMenu(int featureId)無效的面板菜單(特徵 id) |
||||||||||
final boolean | isActive()是否激活 | ||||||||||
abstract boolean | 是不是懸浮狀態
Return whether this window is being displayed with a floating style (based on the
windowIsFloating attribute in the style/theme).
|
||||||||||
abstract boolean | isShortcutKey(int keyCode, KeyEvent event) 是不是這個窗口的快捷鍵(鍵碼,鍵盤事件)
Is a keypress one of the defined shortcut keys for this window.
|
||||||||||
final void | makeActive()讓這個窗口處於激活狀態 | ||||||||||
abstract void | onConfigurationChanged(Configuration newConfig) 但窗口的配置信息改變時(新的配置信息)
Should be called when the configuration is changed.
|
||||||||||
abstract void | openPanel(int featureId, KeyEvent event)打開面板(特徵Id,鍵盤事件) | ||||||||||
abstract View | 得到當前窗口的修飾view:decor view.前提是這個修飾view已經被建立,不然會返回空
Retrieve the current decor view, but only if it has already been created; otherwise returns null.
|
||||||||||
abstract boolean | performContextMenuIdentifierAction(int id, int flags)執行上下爲文菜單某一標識的動做(id,標識) | ||||||||||
abstract boolean | performPanelIdentifierAction(int featureId, int id, int flags)執行面板標識動做(特徵Id,id,標識) | ||||||||||
abstract boolean | performPanelShortcut(int featureId, int keyCode, KeyEvent event, int flags)執行面板快捷鍵(特徵Id,鍵碼,鍵盤事件) | ||||||||||
boolean | requestFeature(int featureId) 請求某一擴展的屏幕特徵有效(特徵Id)
Enable extended screen features.
|
||||||||||
abstract void | restoreHierarchyState(Bundle savedInstanceState)恢復等級狀態(保存的實例狀態) | ||||||||||
abstract Bundle | saveHierarchyState()保存等級狀態 | ||||||||||
void | setAttributes(WindowManager.LayoutParams a) 設置自定義窗口屬性(管理佈局參數)
Specify custom window attributes.
|
||||||||||
abstract void | setBackgroundDrawable(Drawable drawable) 設置窗口背景圖片(圖片)
Change the background of this window to a custom Drawable.
|
||||||||||
void | setBackgroundDrawableResource(int resid) 設置窗口背景圖像資源(資源Id)
Change the background of this window to a Drawable resource.
|
||||||||||
void | setCallback(Window.Callback callback) 設置這個窗口的回調接口,用於中斷按鍵事件和其餘窗口中的動態操做
Set the Callback interface for this window, used to intercept key events and other dynamic operations in the window.
|
||||||||||
abstract void | setChildDrawable(int featureId, Drawable drawable)設置子圖片(特徵Id,圖片) | ||||||||||
abstract void | setChildInt(int featureId, int value)設置子Id(特徵Id,值) | ||||||||||
void | setContainer(Window container) 爲這個窗口設置容器(容器[本質仍是個窗口])
Set the container for this window.
|
||||||||||
abstract void | setContentView(View view) 設置內容view(view)。這是相對於setContetView(View,LayoutParams)的一個更直接的方法。
Convenience for
setContentView(View, android.view.ViewGroup.LayoutParams)
set the screen content to an explicit view.
|
||||||||||
abstract void | setContentView(int layoutResID) 設置內容view(資源)
Convenience for
setContentView(View, android.view.ViewGroup.LayoutParams)
to set the screen content from a layout resource.
|
||||||||||
abstract void | setContentView(View view, ViewGroup.LayoutParams params) 設置內容view(view,LayoutParams)
Set the screen content to an explicit view.
|
||||||||||
void | setDimAmount(float amount) 設置窗口背後的模糊度
Set the amount of dim behind the window when using
FLAG_DIM_BEHIND .
|
||||||||||
abstract void | setFeatureDrawable(int featureId, Drawable drawable)
設置特徵圖片(特徵Id,圖片)
Set an explicit Drawable value for feature of this window.
|
||||||||||
abstract void | setFeatureDrawableAlpha(int featureId, int alpha)
設置特徵圖片透明度(特徵Id,透明度)
Set a custom alpha value for the given drawale feature, controlling how much the background is visible through it.
|
||||||||||
abstract void | setFeatureDrawableResource(int featureId, int resId) 設置特徵圖片資源(特徵id,資源)
Set the value for a drawable feature of this window, from a resource identifier.
|
||||||||||
abstract void | setFeatureDrawableUri(int featureId, Uri uri) 設置特徵圖片Uril(特徵Id,uri)
Set the value for a drawable feature of this window, from a URI.
|
||||||||||
abstract void | setFeatureInt(int featureId, int value) 設置特徵(特徵Id,值)
Set the integer value for a feature.
|
||||||||||
void | setFlags(int flags, int mask) 設置window的標記,做爲一個WindowManager.LayoutParams的標記。 |
||||||||||
void | setFormat(int format) 設置格式(像素格式)
Set the format of window, as per the PixelFormat types.
|
||||||||||
void | setGravity(int gravity) 設置權重(權重)
Set the gravity of the window, as per the Gravity constants.
|
||||||||||
void | setIcon(int resId) 爲窗口設置設置圖標(資源)
Set the primary icon for this window.
|
||||||||||
void | setLayout(int width, int height) 設置佈局(寬度,高度)
Set the width and height layout parameters of the window.
|
||||||||||
void | setLocalFocus(boolean hasFocus, boolean inTouchMode) 設置本地焦點(是否具備焦點,是不是觸屏模式)
Set focus locally.
|
||||||||||
void | setLogo(int resId) 設置Logo(資源)
Set the logo for this window.
|
||||||||||
void | setSoftInputMode(int mode) 設置軟輸入模式(模式)
Specify an explicit soft input mode to use for the window, as per
WindowManager.LayoutParams.softInputMode .
|
||||||||||
abstract void | setTitle(CharSequence title)設置標題(標題) |
||||||||||
abstract void | setTitleColor(int textColor)設置標題顏色(顏色) | ||||||||||
void | setType(int type) 設置窗口類型(類型),正如每一個窗口布局的類型 Set the type of the window, as per the WindowManager.LayoutParams types. |
||||||||||
void | setUiOptions(int uiOptions) 設置額外的UI操做(UI操做)
Set extra options that will influence the UI for this window.
|
||||||||||
void | setUiOptions(int uiOptions, int mask) 設置額外的UI操做選項(操做,動做掩碼)
Set extra options that will influence the UI for this window.
|
||||||||||
abstract void | setVolumeControlStream(int streamType)設置音量控制流(流類型) | ||||||||||
void | setWindowAnimations(int resId) 設置窗口動畫(動畫資源)
Specify custom animations to use for the window, as per
WindowManager.LayoutParams.windowAnimations .
|
||||||||||
void | setWindowManager(WindowManager wm, IBinder appToken, String appName, boolean hardwareAccelerated) 設置窗口所用的窗口管理器,如用來顯示plane。
Set the window manager for use by this Window to, for example, display panels.
|
||||||||||
void | setWindowManager(WindowManager wm, IBinder appToken, String appName) 設置窗口所用的窗口管理器,如用來顯示plane。
Set the window manager for use by this Window to, for example, display panels.
|
||||||||||
abstract boolean | superDispatchGenericMotionEvent(MotionEvent event) 派遣鼠標事件(鼠標事件) 被自定義的window使用,如diaglog。用於將通常的鼠標事件向下傳遞到view層級中。
Used by custom windows, such as Dialog, to pass the generic motion event further down the view hierarchy.
|
||||||||||
abstract boolean | superDispatchKeyEvent(KeyEvent event) 派遣鍵盤事件(鍵盤事件) 被自定義的window使用,如diaglog。用於將通常的按鍵事件向下傳遞到view層級中。
Used by custom windows, such as Dialog, to pass the key press event further down the view hierarchy.
|
||||||||||
abstract boolean | superDispatchKeyShortcutEvent(KeyEvent event) 派遣快捷鍵事件(鍵盤事件) 被自定義的window使用,如dialog。用於將通常的鍵盤事件向下傳遞到view層級中。
Used by custom windows, such as Dialog, to pass the key shortcut press event further down the view hierarchy.
|
||||||||||
abstract boolean | superDispatchTouchEvent(MotionEvent event) 派遣觸摸事件(鼠標事件) 被自定義的window使用,如dialog。用於將通常的觸屏事件向下傳遞到view層級中。
Used by custom windows, such as Dialog, to pass the touch screen event further down the view hierarchy.
|
||||||||||
abstract boolean | superDispatchTrackballEvent(MotionEvent event) 派遣軌跡事件(鼠標事件) 被自定義的window使用,如dialog,用於將軌跡事件向下傳遞到view的層級中。
Used by custom windows, such as Dialog, to pass the trackball event further down the view hierarchy.
|
||||||||||
abstract void | takeInputQueue(InputQueue.Callback callback) 取得輸入的隊列(輸入回調接口) 得到輸入隊列的全部權
Take ownership of this window's InputQueue.
|
||||||||||
abstract void | takeKeyEvents(boolean get) 取得鍵盤事件(是否得到) 請求得到鍵盤事件到這個activity。
Request that key events come to this activity.
|
||||||||||
abstract void | takeSurface(SurfaceHolder.Callback2 callback) 取得該window的surface的擁有權控制權。(SurfaceHolder.CallBack2接口)
Take ownership of this window's surface.
|
||||||||||
abstract void | togglePanel(int featureId, KeyEvent event) 切換面板(特徵Id,鍵盤事件) |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
final int | getFeatures()
獲取啓用的特徵
Return the feature bits that are enabled.
|
||||||||||
final int | 獲取被客戶明確設置的window flag,所以將不會被getDecorView修改。
Return the window flags that have been explicitly set by the client, so will not be modified by
getDecorView() .
|
||||||||||
final int | 獲取被這個窗口實現的特徵
Return the feature bits that are being implemented by this Window.
|
||||||||||
final boolean | 是否有軟輸入模式
Has the app specified their own soft input mode?
|
||||||||||
abstract void | onActive()是否激活 | ||||||||||
void | setDefaultWindowFormat(int format) 設置默認的窗口模式(模式)
Set the default format of window, as per the PixelFormat types.
|