I'm having a weird issue after I upgrated gradle to version 7.4.0 from 7.0.4.
basically it looks like the "app window" has shrink vertically, so some space appears above the navigation bar and it changes its color as seen below. it seems that the amount of space increases if the device has a taller form factor.
I can reproduce this issue only on devices with api >=26. also is not visible if the device is "short". for example is not visible on a Pixel 2 emulator or nexus 5 but is huge on a pixel 6.
below some visual examples:
normal look: ( pixel 3 api 33 emulator)
wrong look: (pixel 3 api 33 emulator)
wrong look: (pixel 3 api 33 emulator with gesture navigation)
wrong look: (physical pixel 6a with gesture navigation)
wrong look: (pixel 6 api 26 emulator)
the Layout Inspector only shows the correct app area down to the bottom navigation menu, so it looks like the system is adding the extra space. also bottom sheets begin above the added space.
so it looks like the app has a maximum aspect ratio and doesn't expand to the whole screen lenght
any idea what's going on?
I finally solved this by adding
android:resizeableActivity="true"
to my <application> tag thanks to this question.
However it remains a mistery how this was the culprit as the issue only appeared after upgrading gradle and also according to the documentation this attribute should default to true.
Related
In the app I am working on, there is inconsistency between what is displayed in the Android Studio UI builder and the 2 phones I tested it on (A nexus 6p and an Xperia XZ Premium. They both have the same aspect ratio, with the 6p being 2560x1440 and XZ being 3840x2160 but scaled down to 1920x1080 during normal use if I understand correctly)
For instance: I have 3 buttons with a static width in dp at the top of the screen in a constraintlayout, and in the UI builder they go from one end of the screen to the other, each constrained to the left and evenly spaced. In the builder and on the 6p, it displays properly. However, on the XZ, it is but off.
After further testing, it seems the XZ always cuts off around 25dp on the right and bottom when the layout contains objects with set widths and lengths that cross into those missing 25dp. How do I fix this? The 6p displays everything just fine
Try using auto layout constraints to help adjust the dimensions. Something you should consider for the future is that you need move fragments, that will insure consistent UI over many versions of android phones and tablets currently in the market.
Android layout view can help you do all that.
Right click not the textfield/button that you want to set to a specific constraint and let the magic happen.
I am using Titanium to build an app. I created an android emulator using a standard device definition Nexus 4 (4.7", 768X1280: xhdpi, Android 4.1.2 - APU Level 16 , ARM (armebi-v7a) when I run it , the outside orientation appears correct but the screen itself is upside down. See image:
! [upside down emulator] (http://www.tiikoni.com/tis/view/?id=c0d737c)
I have deleted the emulator and re-created it a couple of times. I chose this one as it appears to have the highest screen density and the smallest screen physical size. Is there a way to fix this? when my app runs, it does appear correctly, but using the emulator is weird. Loke for opening the app drawer, you don't click on the icon where it is displayed, but you click where it should be.
Unchecking the "Use Host GPU" corrects the situation. I do not know why, but it does.
Try left Ctrl + F12. to rotate emulator.
also refer
The fix to this for me was very simple. I entered the resolution as height x width and it was upside down. So I entered width x height and it became OK.
Please check your XML and set proper background to the parent view.
I have an app, which provides a switchable set of night mode (red) controls using a custom Theme. The controls are in the Shared Preferences view. I have copied and colored all of the necessary images for my controls from Android git sources' hdpi and mdpi folders. The red theme works perfectly fine on the 160 dpi screen (480x800 Android 3.2), but on the 240 dpi one (480x854 Android 2.1) custom check boxes and radios are invisible, they do not occupy any space on the line with label either. Though the drop down list control on a simple linear view seems to be shown perfectly fine. The only difference I can see is that the later one has .9.png images.
What is wrong and how to fix that?
HURRAY! Found the solution by an accident. I have added a hidden checkbox item to one of the first views of my application, and all of the styled checkboxes magically appeared as they should be in every other view! I believe it's a bug in the 2.1 version of Android. I saw something like that mentioned once while googling for the problem here. It might be irrelevant though.
I am developing an Android application that uses a RatingBar, with 5 stars.
I have a HTC Wildfire, and RatingBar works very good. I have a layout for this screen.
However, I am testing in a HTC desire and it appears 4 stars, and it seems RatingBar doesn't work well.
I found a temp solution, adding this to the Manifest:
<uses-sdk android:minSdkVersion="4"
android:targetSdkVersion="7" />
And RatingBar works perfect, but another layout of an Activity looks now bad.
And in Wildfire, my layouts looks now bad too...
How can I do? Is it a bug of Ratingbar?
The problem has bothered me....setting minSdkVersion="4" is effect.But another views may looks bad.
I’ve just spent far too long wondering why the RatingBar views in my Android XML layouts look different on the emulators, HTC Hero and HTC Desire. Small style rating bars seemed to have no concept of their actual size and the large rating bars for user interaction were clipped and falling of the edge of the layouts.
The answer is that the RatingBar view doesn’t scale properly on high density screens if you have the build target set to Android 1.5. The fix is to target API level 4, add screen support declaration to the manifest and then be careful not to break anything for the 1/3 of users still on Android 1.5.
Try setting the layout_hight of rating bar bigger:
android:layout_height="20dp"
See:
http://blog.csdn.net/prince58/article/details/6371389
I have a problem with missing pixels on QVGA screen on Android (all versions including 2.2). The original problem was with LinearLayout and margin="1px". It was OK on the normal screen but on QVGA there was sometimes no space between GUI controls, like if margin="0px" and not 1px. So I tried to make the example simple (to be sure that it is not a LinearLayout bug), I have just put transparent (height = 10px) and white (height = 1px) images into ImageViews into the main screen. 25% of the white images are not shown on the QVGA screen. The behaviour on the normal screen is OK. The screenshots are from the emulator but the problem exists on real devices too.
See screenshots on my web page.
Is it an Android bug? Can I do anything with it? Note that my original problem was with LinearLayout and margin="1px". Is there something like margin="1px_that_is_not_hidden"? (pt, dp, dip, ... don't seem to be solution)
Many thanks for a reply.
You are probably in a compatibility mode, where Android is attempting to scale your dimensions for you, rather than thinking that you know what you're doing. It's been ages since I targeted a QVGA device, so I forget the precise details. However, I recommend you read the multiple-screen-size instructions. In particular, you probably need to set android:anyDensity="true" in your <supports-screens> element.