I want my gluon application to be able to change orientation from Landscape to portrait in run time. I have check the Gluon Charmdown SDK, It seem that it have only getOrientation and don't have an option to set an orientation in runtime. I don't want to set fixed orientation in Manifest
标签:
gluon-mobile
相关问题
- Gluon Mobile ScrollPane Optimization
- How to request permissions during run time when us
- Schedule a Task in Android using ALARM_SERVICE ser
- mobileapplication.mobileevent BACK_BUTTON_PRESSED
- How to set request orientation in runtime?
相关文章
- mobileapplication.mobileevent BACK_BUTTON_PRESSED
- How to set request orientation in runtime?
- compile and build gluon mobile app for desktop
- getPublicStorage(“Pictures”) lists no files
- Poor ListView performance on Gluon
- 胶子的魅力下降3.0.0 - 如何创建cusom插件(Gluon Charm down 3.0.0
- 解决方法没有回落到以前的Buildships创造胶子工程?(Workaround for creat
- under gluon project how to get the Android assets
Charm Down has an OrientationService, but as you have mentioned, it is "read only", it just listens to orientation changes and gives you the current orientation at any time. But so far you can set the orientation programatically.
To include this feature there are two options: clone Charm Down, modify the Orientation Service, build and use your custom build, or directly create a new service, like
ExtendedOrientationService
, that you can include in your project directly.Assuming the latter, this is a very basic implementation of a service that allows setting the orientation programmatically:
ExtendedOrientationService.java
ExtendedOrientationServiceFactory.java
For Android:
AndroidExtendedOrientationService.java
On iOS:
ExtendedOrientation.h
ExtendedOrientation.m
IOSExtendedOrientationService.java
Now add the
ios-gradle.build
file from this sample.Finally we need to build and include the native library:
build.gradle
You can build and add the library to the project with:
SAMPLE
This snippet shows how to use this service: If the orientation is vertical it will force horizontal orientation, else it will release the orientation: