Scaling & Softkeys

RichardN

Well-Known Member
Licensed User
Longtime User
I have an App with a couple of views scaled to 100%x,100%y like this...

B4X:
AutoScaleAll
txtDetail.SetLeftAndRight(0,100%x)
txtDetail.SetTopAndBottom(0,100%y)

lstAircraft.SetLeftAndRight(0,100%y)
lstAircraft.SetTopAndBottom(0,100%y)

imgTitle.Width= 82%x
imgTitle.Height = imgTitle.Width * 0.38
imgTitle.Top = 2%y
imgTitle.HorizontalCenter = 50%x

I have also optimised for 4.x.x with:

B4X:
AddManifestText(
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="16"/>
<supports-screens android:largeScreens="true" 
    android:normalScreens="true" 
    android:smallScreens="true" 
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:theme, "@android:style/Theme.Holo")
SetApplicationAttribute(android:label, "$LABEL$")

The code works perfectly on a wide variety of devices.... except one, the Galaxy Nexus running 4.1.1 where the Back/Home/Switch soft keys are masking the lower few millimeters (and all of the last list item) of the views that are scaled to 100%y.

Why is this ??? What an I doing wrong ???
 
Last edited:

Erel

B4X founder
Staff member
Licensed User
Longtime User
It looks like this on Galaxy Nexus:
SS-2012-10-21_09.28.28.png
 
Upvote 0

RichardN

Well-Known Member
Licensed User
Longtime User
Erel,

The screen you show is exactly as I am getting on all devices, however.....

There are two views, 'txtDetail' and 'lstAircraft', that will later appear in front of the initial layout views. After creating them I dimensioned them off the screen so I could work on the intial layout. I then scaled all the views in the designer (including these two) and this has worked perfectly for all platforms except the Nexus with soft keys.

B4X:
txtDetail.SetLeftAndRight(0,100%x)
txtDetail.SetTopAndBottom(0,100%y)

lstAircraftinitial.SetLeftAndRight(0,100%y)
lstAircraft.SetTopAndBottom(0,100%y)

Despite vertical scaling to (0,100%y) the bottom of both views appear to continue below the soft keys on the Nexus masking the content. Here is a screenshot:

listview.jpg


In this image the listview is scrolled right to the end but both the LAST item AND half of the previous item are masked by the softkeys.
The 'txtDetail' EditText view exhibits identical behavior and will not scroll completely to reveal the last of the content.

As an experiment I tried sizing the two offending views to full screen for the original layout size in correct Zorder and the client reports that both views now fuction correctly.

An inconsistency of scaling...... and a design practice to avoid.

Is there a good Nexus skinned AVD with softkeys to be downloaded anywhere to avoid this problem ????
 
Upvote 0

RichardN

Well-Known Member
Licensed User
Longtime User
Erel... Have a look at this. Two ListViews both populated with dummy items 1-50.

One view is designed as full screen on the parent 320x480x1 Activity, the other is the same size but off the screen where Top=500, Left=400. The ListViews seem to perform perfectly except when run on a device with soft-keys at the base of a portait view.

Look particularly for the last list item on the red ListView.

I have been looking for a good Nexus skinned AVD but have been unable to locate. Any ideas ???
 
Upvote 0

RichardN

Well-Known Member
Licensed User
Longtime User
you should always load the layout in Activity_Create not only when FirstTime = True.
Appreciate that, I threw the code together in a hurry to try and demonstrate the scaling misbehavoir.

Without one of these devices myself I am unable to replicate the misbehaviour reported by the client.
 
Upvote 0
Top