android-window

Incorrect displayCutout in landscape orientation when you hold your device at some angle

耗尽温柔 提交于 2021-02-05 11:23:11
问题 So we can get for example safe inset top value (useful for devices which have notch/cutout): override fun onAttachedToWindow() { super.onAttachedToWindow() if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { val safeInsetTop = window.decorView.rootWindowInsets?.displayCutout?.safeInsetTop if (DEBUG) Timber.d("onAttachedToWindow, safeInsetTop: $safeInsetTop") } } override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) if (DEBUG) Timber.d("onCreate") if

How to create a floating window like Clipboard Pro App?

柔情痞子 提交于 2020-05-25 19:58:52
问题 The following image is a window of the app https://play.google.com/store/apps/details?id=jp.snowlife01.android.clipboard. i named it as main window. It's seem that main window is not a normal window. it's on the top of other windows, the main window can't be moved. A small point icon will be displayed when I click the minimized button in the main window, the small point icon can be moved, the main window can be restored when I click the small point icon. I think the small point icon is a

Make clear about addFlags and setFlags in android.view.Window class

大憨熊 提交于 2020-03-18 06:52:20
问题 I know what setFlags does is replacing the old flags with the new ones. And addFlags is appending more flag. I'm just confused why are the arguments in setFlags method that I've seen usually the same? For example: getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); //or getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); After taking a look at android

Make clear about addFlags and setFlags in android.view.Window class

試著忘記壹切 提交于 2020-03-18 06:50:18
问题 I know what setFlags does is replacing the old flags with the new ones. And addFlags is appending more flag. I'm just confused why are the arguments in setFlags method that I've seen usually the same? For example: getWindow().setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION, WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); //or getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); After taking a look at android

Dark-text transparent status bar with opaque navigation bar

自闭症网瘾萝莉.ら 提交于 2020-02-03 05:38:10
问题 Wait, it is not a duplicate A similar question has been asked here, but not addressing dark-text status bar. What I want to do I want to achieve 3 things at the same time : Transparent status bar (Not hiding it!) Dark-text status bar Opaque (or black) navigation bar (which does not let activity content inflate underneath it ) What I have tried The solution getWindow().getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN); can only

How to get the window instance from a view?

▼魔方 西西 提交于 2020-01-14 19:22:09
问题 i add a view in the windowManager via mWindowManager.addview() . Now i would like to know if it's possible to get the window instance. their is myView.getWindowID() and myView.getWindowToken() but i can't find a way to retrieve from it the window instance 回答1: If your View has been attached to Activity , you can do like this. View view; // your view if (view.getContext() instanceof Activity) { Window window = ((Activity) view.getContext()).getWindow(); } After API 19, there is a convenient

Display DialogFragment content below status bar

▼魔方 西西 提交于 2019-12-20 14:48:53
问题 Im trying to display an DialogFragment with match_parent both for height and width but it happens that on top the DialogFragment is being displayed below StatusBar. The DialogFragment is applying some default value for padding on bottom, right, left, and top. But the top padding should start counting from statusBar and not from the total screen size. How can I set DialogFragment to be match_parent, but have the normal/default padding on top,bottom,right,left? 回答1: By default Dialog would be

What is an Android window?

折月煮酒 提交于 2019-11-28 14:44:21
问题 What is a Window in Android? I thought the top-most level in Android is called Activity , which is the screen you see. Can someone tell me what a Window in Android is? do we just have one or multiple of them. 回答1: The Activity is what you would call a Window. Technically speaking, the Activity creates the Window for you. You can have many of them, but normally not synchronously. To ask for additional information you can call a Dialog, or fire an Intent to another Activity. For more

Is there a way to programmatically locate all Windows within a given application?

心已入冬 提交于 2019-11-28 05:03:05
Is it possible to programmatically enumerate all of the android.view.Window s, or decor views within an application? Dialogs for example will both open in a new Window , separate from the main Activity window. I can locate them via Dialog.getWindow() but I'm not sure how I would do this with a built-in components such as the activity menu popup. Is there any way, from an Application , Context , or the WindowManager , or something else, to enumerate the Windows associated with my app? I can see all of my application's windows with adb dumpsys window , but I'm looking for a way to do this within

Is there a way to programmatically locate all Windows within a given application?

只谈情不闲聊 提交于 2019-11-27 00:46:10
问题 Is it possible to programmatically enumerate all of the android.view.Window s, or decor views within an application? Dialogs for example will both open in a new Window , separate from the main Activity window. I can locate them via Dialog.getWindow() but I'm not sure how I would do this with a built-in components such as the activity menu popup. Is there any way, from an Application , Context , or the WindowManager , or something else, to enumerate the Windows associated with my app? I can