Android Question Hi there,a quick ???

Lary Yenta

Member
Licensed User
Longtime User
One of the modules in my project is a graph, how can I "force" the graph into landscape mode? I have been looking but I can't find it anywhere.

Thanks in advance,

lary
 

DonManfred

Expert
Licensed User
Longtime User
the graph into landscape mode
To do it by code @eurojam already told you how.
But you can also do it with the manifesteditor

Add one line for each activity you want to run in a specific orientation
B4X:
SetActivityAttribute(orderdetails,android:screenOrientation, "sensorLandscape")
replace the orderdetails with the activityname
 
Upvote 0

gz7tnn

Member
Licensed User
Longtime User
I realize this is a older post but I have tried the Manifest approach to force screen orientation to sensorLandscape but my app will not "compile and run".
It does a Test Compile without any problem.
I am on B4A V2.71 with Core 2.71 and using Phone lib 2.10

When I add the following to the Manifest:
SetActivityAttribute(Main,android:screenOrientation, "sensorLandscape")

I get the following error when compiling:
Parsing code. 0.02
Compiling code. 0.13
Compiling layouts code. 0.00
Generating R File. Error
AndroidManifest.xml:17: error: Error: String types Not allowed (at 'screenOrientation' with value 'sensorLandscape').

I can however obtain the correct sensor landscape rotation by using the following command immediately after the activity.loadlayout.
phone1.SetScreenOrientation(6)

Attached is a small example with the Manifest entry that fails.
Because the phone1.SetScreenOrientation(6) approach works it is not a great issue, but reading post #3 it seems the Manifest approach allows a single place to define multiple activity orientation - which may be useful at some stage.

{Sorry - the layout is designed for 7" tablet so will not look too good on a smaller screen}
 

Attachments

  • sensorLandscapeTest.zip
    7.4 KB · Views: 106
Last edited:
Upvote 0

gz7tnn

Member
Licensed User
Longtime User
Thanks for quick reply. I tried that and still no luck.
Does the minSDK version translate to meaning that I need to have the Android 2.3.1 (API 9) SDK platform installed?
If so then I don't have that one, and when I tried to install it I see it is obsolete.
I tried setting the minSDK to 10 and 11 but no luck there.

Excuse my ignorance in this area, so may not be understanding what this means.
Will need to try again tomorrow.
 
Upvote 0
Top