Android Question B4Xpages - Orientations: landscape 180 degreess rotated

MarcRB

Active Member
Licensed User
Longtime User
Hello,

I know B4XPages doesn't support rotation by sensor in B4A.
Is it possible or is there a good workaround to show layouts landscape with the tablet top on right side? I mean landscape and 180 degrees rotated.
With activity's I used SensorLandscape, but that isn't possible for Pages.

My Tablet case has a kickstand. In that landscape stand the case is rotated 180 degrees. But it is still Landscape.

#SupportedOrientations: landscape-180
 

MarcRB

Active Member
Licensed User
Longtime User
At compile I got an error when using SensorLandscape

Main:
#Region  Project Attributes
    #ApplicationLabel: MyApp
    #VersionCode: 1103001
    #VersionName:  V11.03.1
    #SupportedOrientations: Sensorlandscape
    #CanInstallToExternalStorage: False
#End Region

During compile i see this...
Compiler error:
B4A Versie: 10.70 BETA #3
Controleren code.    (0.29s)
    Java Versie: 11
Building folders structure.    (0.03s)
Voer een bijzondere actie uit.    (0.10s)
Compileren code.    (0.20s)
Compileren weergaven code.    (0.01s)
Bibliotheken organiseren.    (0.00s)
    (AndroidX SDK)
Compiling resources    (0.10s)
Linking resources    Error
AndroidManifest.xml:25: error: 'Sensorlandscape' is incompatible with attribute screenOrientation (attr) enum [behind=3, fullSensor=10, fullUser=13, landscape=0, locked=14, nosensor=5, portrait=1, reverseLandscape=8, reversePortrait=9, sensor=4, sensorLandscape=6, sensorPortrait=7, unspecified=4294967295, user=2, userLandscape=11, userPortrait=12].
error: failed processing manifest.

I also tried the integer value 6 and 8 ReverseLandscape

I'm rewriting my 17 activity project to pages. Just started. So everything is still very clean, nothing that can conflict with the orientation.

Manifest:
'This code will be applied to the manifest file during compilation.
'You do not need to modify it in most cases.
'See this link for for more information: https://www.b4x.com/forum/showthread.php?p=78136
AddManifestText(
<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="30"/>
<supports-screens android:largeScreens="true"
    android:normalScreens="true"
    android:smallScreens="true"
    android:anyDensity="true"/>)
SetApplicationAttribute(android:icon, "@drawable/icon")
SetApplicationAttribute(android:label, "$LABEL$")
CreateResourceFromFile(Macro, Themes.LightTheme)
'End of default text.
 
Upvote 0

William Lancee

Well-Known Member
Licensed User
Longtime User
I have used the phone library and put the following in Main Activity. It works for me.

B4X:
Sub Activity_Create(FirstTime As Boolean)
    'Comment out #SupportedOrientations: in Project Attributes , actually this doesn't matter, it is superseded by code.
    Dim ph As Phone
    ph.SetScreenOrientation(8)

    Dim pm As B4XPagesManager
    pm.Initialize(Activity)
End Sub
 
Last edited:
Upvote 0
Top