My problem is that components inside a ConstraintLayout spill out of the screen. My app has always worked and I have not made changes to these layouts recently. Now, buttons and views are shifted right and down. The constraints on the components act as if the layout was larger. Suddenly, this problem appeared on an S10, an S9 and an A70 without the app having been updated.
Screenchot of the bug
Screenshot of the normal screen
After taking a screenshot, the layout somewhat comes back to its normal state
The play button is supposed to be centered in x and y. The constraint are all at 0 with the parent view. The remove ads button is constrained left and right equally and from the top only. The array of buttons at the bottom are all within a view, which is constrained equally on the left and right and only from the bottom.
One thing that I noticed is that on my S10, the display settings are either 3040x1440 or 2280x1080. I currently have it set to 3040x1440. It seems like the components are shifted right just enough to fit as if they were in the center of the 3040x1440, but we are only seeing the first 2280x1080 pixels of the screen.
This problem also coincides with the fact that the app now appears with the gaming navigation bar at the bottom. I have never seen my app with this navigation bar before. On the three phones that exhibit this problem, the gaming navbar had never appeared before now and the problem started happening as soon as the bar was introduced. I did not have control over this.
One way I am able to come back to my desired normal layout is by quitting the app and coming back to the app through recently opened apps or via the app icon. Then, the layout is normal until I change activity. Then, the next activity is also spilling out.
All the activities in the app are set to "portrait" in the manifest. All my activities use a ConstraintLayout as their main layout, but not all activities experience this problem.
When that bug was first reported, I tried to reproduce it. The only way I was able to reproduce the bug was by having the app open in split-screen, opening a second app, turning the device sideways to landscape mode and then closing the second app by extending my app. The fact that the phone went from landscape to portrait and fullscreen made it exhibit the comportment you see here.
I think this has to do with the gaming navbar being updated because literally nothing changed in the app between yesterday and today and now this problem exists.
What I tried:
I tried to not hide the navbar and not make the app fullscreen by commenting this code:
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(
View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
This did not work, the gaming navbar was present and the UI was still spilling out.
Since, the problem seemed to come from the fact tha tthe app thought it was horizontal, I tried adding this to the affected activities:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
This did not work however.
One activity that experiences this bug doesn't have more UI related code than what is shown here, so I don't think the bug is in my code as the app has worked for months.
I have resolved my issue. Somewhat, my app was using a beta version of the ConstraintLayout.
I simply changed my dependencies from:
implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta2'
With the most recent version of ConstraintLayout found here, which is:
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
Related
In Android-11, I enabled the Gesture navigation in the Android System Settings and launched a sample application(which contains only one editText on the Screen) using my custom App Launcher. you can see in the below screenshot,
Gesture Navigation means there is no 3-button navigation, similar behavior of iPhones behavior,
You can see in the above image at the keyboard bottom, that there is some additional space available, so in order to remove the space, I used the below code to hide that
WindowInsetsController wcon = getWindow().getInsetsController();
wcon.hide(WindowInsets.Type.navigationBars());
wcon.setSystemBarsBehavior(WindowInsetsController.BEHAVIOR_SHOW_TRANSIENT_BARS_BY_SWIPE);
So, after I used the code, I got the expected behavior as below, in this stage everything is working fine, (the additional area is hided)
But,
Once I moved this from recent apps like below and again moved back from the normal stage, the Bottom keyboard area touch is not working, I highlight using the Red Color,
This only happens, when I launched the app using Custom App
What went wrong with this behavior, Why is the bottom area not working?
I have an app where fragments are switched in and out of the screen using a bottom tab bar. One of those fragments is made full screen using
getActivity().getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
and that is undone when you leave that fragment.
The problem is that when you leave that fragment and switch to another one, the bottom tab bar drops about halfway off the screen, until a touch event is registered, and then it jumps back to where it's supposed to be. It works fine in the full screen fragment, and fine after the touch event, it's just when you switch away from the full screen fragment, it goes about halfway off the screen.
I am not able to post the code as it is proprietary, but if there are any questions, I can do my best to answer them.
I should note that this issue does not happen on Android Q (API 29), regardless of device.
In Samsung Galaxy S3, even though my app is set to be full screen, and this makes the notification bar not to be visible, if I swipe from the very edge of the screen side, this action will make the notification bar to appear again, allowing the user to expand it over the full screen app.
Is there any way to disable this, or to cancel the expand of the notification bar?
The problem is that I have a listview covering the whole screen, and if I swipe to scroll the items, every time I do it from the very edge due to the instinctive action of scrolling faster, then the notification bar appears again.
I've tried tricks such as creating an overlay window on the edge, but not working at all for SG3.
Thanks
If you haven't tried already, you might attempt to use the View flag for hiding navigation, SYSTEM_UI_FLAG_HIDE_NAVIGATION, documented here.
However it may be important to note this found at the bottom of their description :
There is a limitation: because navigation controls are so important, the least user interaction will cause them to reappear immediately. When this happens, both this flag and SYSTEM_UI_FLAG_FULLSCREEN will be cleared automatically, so that both elements reappear at the same time.
which is probably related to what you're seeing. I find it hard to believe there's a way around this... I just tried and every fullscreen app I have on my S3 behaves this exact same way.
I suspect that if there was a way around it (assuming the above doesn't work, which I don't expect it to), it would be considered to be a bug by the Android team, and I would advise against it.
I am developing a magazine reader application aimed at the Kindle Fire. In landscape mode the built in softkey bar and status bar in the Kindle's operating system leave little room for my content so I have opted to run the activity in fullscreen mode using the following theme for the activity:
android:theme="#android:style/Theme.NoTitleBar.Fullscreen"
This works fine, the status bar is hidden and the softbar is minimized like so:
I can bring up the menu bar by dragging it up like so:
The bug arises when I then click somewhere on screen to dismiss the softkey bar. The bottom bar slides back away, the top one does too but the space that it took up becomes a black void and my app is pushed down underneath it so my tab bar at the bottom of the app is now unusable:
I am using a tabhost activity here and the tab I am on in these screenshots is the actual reader section of the app. This subactivity uses a PDF viewer widget which is written using native code and this bug only happens on this tab. If I switch to one of the other tabs which contain no JNI code this bug does not happen so I'm pretty sure its the combination of the Kindle Fire OS, the fullscreen activity and the use of JNI code.
Has anyone else experience this issue?
Any help much appreciated!
Thanks
There are a couple of fullscreen modes for the Fire (at least the new ICS based ones) - check out https://developer.amazon.com/sdk/fire/cx-guidelines.html#Fullscreen for the options. I suspect the ICS Full Screen mode will be what you need
Also it's probably worth trapping the onOrientationChanged and onSizeChanged events to make sure you re-draw the screen correctly when the menu/toolbars appear and disappear per the screen layout sample at https://developer.amazon.com/sdk/fire/samples.html
Screenshots Below. As you can see, my menubutton is showing up in the actionBar's overflow area. It doesn't work well on portrait, because it adds a second row (cannot fit next to my tabs, obviously); it looks okay on landscape, but I will be changing the way the tabs present themselves on landscape, so it'll end up having the same problem as portrait. So, what I need to accomplish, is getting the menu button into the bottom black area of the screen, which, my understanding says is actually legacy support. Is there no method to declare to send my menu button down to the right of task switcher as I've seen in some other apps? Is the solution to change my targetSDKversion in AndroidManifest?
Can't be done, as can be seen via CommonsWare's link :(