Questions tagged [android-window]

49 questions
3
votes
2 answers

How to check if user touched anything?

I want to know when the user is interacting with my app. I've tried to use Window.Callback but I faced an issue with Toolbar. In case we call setSupportActionBar (setActionBar) my Window.Callback doesn't receive events anymore. Restriction: I can't…
Onregs
  • 420
  • 3
  • 16
3
votes
1 answer

Get absolute coordinates of view inside popup window

I have a draggable popup window fragment. I need to get the x and y coordinates of that fragment in onSaveInstanceState(). I got the width and height of the fragment by using getView().getWidth() and getView().getHeight(). But if i use…
3
votes
2 answers

Listener to detect whether a view is at the front?

I have RecyclerView and, in some cases, I show another view on top of it - ProgressDialog, AlertDialog or DialogFragment. Is there some way to notify me about cases when my RecyclerView is at front or another view is above it now? I tried to add…
Goltsev Eugene
  • 3,325
  • 6
  • 25
  • 48
3
votes
2 answers

fitsSystemWindows="true" doesn't work after calling setContentView()

For an app I'm developing I wanted to reload the UI after a user input (basically resetting it completely after they made changes to it). I wanted to try avoiding destroying/recreating the activity and use setContentView() instead because it's a lot…
2
votes
1 answer

How to correctly create a draggable floating view?

I use the following code to drag a view around the screen, and it works. But, when the user first touches moveIcon, the floatingView suddenly moves to the center of the screen, even though I want it to remain in its position. How can I fix this? I…
user19763422
2
votes
0 answers

bringToFront for Floating Window TYPE_APPLICATION_OVERLAY

I have created multiple Floating Windows using TYPE_APPLICATION_OVERLAY as below WindowManager.LayoutParams params = new WindowManager.LayoutParams( width, height, x, y, …
2
votes
1 answer

Disable fullscreen mode after setting FLAG_LAYOUT_IN_SCREEN in Android

I have to inherit a custom main activity class which is a 3rd party lib and I cannot make any change to the class. This class adds FLAG_LAYOUT_IN_SCREEN to the window and it causes the app to be on full screen. However, I wanna prevent this…
Semih Gokceoglu
  • 1,408
  • 1
  • 13
  • 21
2
votes
2 answers

Using FLAG_NOT_TOUCHABLE, gives Not Responding error

Is there any way to remove that error? I am using FLAG_NOT_TOUCHABLE in my activity, but when I touch the screen it appear not responding error... WindowManager.LayoutParams params = getWindow().getAttributes(); params.flags |=…
1
vote
1 answer

How to use WindowInsetsCompat correctly to listen to keyboard height change in Activity?

It seems like the official way, to listen to keyboard height change, is to use WindowInsetsCompat based on https://developer.android.com/develop/ui/views/layout/sw-keyboard ( An unofficial is to have an invisible PopupWindow to monitor keyboard…
Cheok Yan Cheng
  • 47,586
  • 132
  • 466
  • 875
1
vote
1 answer

Draw behind status bar but not behind system navigation bar with WindowCompat.setDecorFitsSystemWindows(window, false)

I want to draw my layout behind the status bar but not behind system navigation controls panel (at the bottom of display) Right now I use WindowCompat.setDecorFitsSystemWindows(window, false) and layout takes all space of the display, but I only…
user924
  • 8,146
  • 7
  • 57
  • 139
1
vote
0 answers

Is Clearing WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS flag now unnecessary for setting status bar in android?

https://developer.android.com/reference/android/view/Window#setStatusBarColor(int) Documentation above says that we need to clear WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS flag to set status bar color. But…
박찬준
  • 346
  • 1
  • 7
1
vote
1 answer

Switch Status Bar Text Color / setAppearanceLightStatusBars of WindowController is not working as expected

I am using two different backgrounds for my app depending on which screen is active. In general the status bar is transparent and the background should lay behind it. Depending on the background I need the color of my status bar text to be either…
1
vote
1 answer

WindowInsetsCompat.isVisible(WindowInsetsCompat.Type.ime()) returns true for Android 23-29, though keyboard is not opened

If keyboard is opened the next code returns true (for showingKeyboard) on Android 11 (30 API) or false otherwise: private fun registerGlobalLayoutListener() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { …
user924
  • 8,146
  • 7
  • 57
  • 139
1
vote
1 answer

Getting View object of any AlertDialog instance that is visible in current Activity (Android)

I have code that will take a drawing screenshot of the current window's root view. The problem is, the screenshot is only taken of the activity that is running. It does not draw any AlertDialog that may be visible inside the activity. Is there a…
buradd
  • 1,271
  • 1
  • 13
  • 19
1
vote
1 answer

ViewTreeObserver.OnWindowFocusChangeListener in a service

How to implement ViewTreeObserver.OnWindowFocusChangeListener in a service in Android . The code does not show any type of error when i use it in my java file . Is there any other way to use OnWindowFocusChangeListener in a service ? Please help…