语言

Menu
Sites
Language
Screen Orientation

Hello,

In Android, we set auto orientation. We see content change to landscape as it is if we rotate the phone to landscape. We can also detect the screen orientation to change the layout to match landscape screen if we want to.

Similarly we try to do the same on the Tizen:

1. We set the Auto Orientation, rotate the phone to landscape, the content change automatically to landscape without changing content format.
2. If needed detect the orientation and change the content layout to match the landscape.

How to do this?

响应

1 回复
talari praveen kumar

Hi , 

Try this code

tizen.systeminfo.addPropertyValueChangeListener("DEVICE_ORIENTATION", onSuccessOrientationCallback, function(){}, {});

function onSuccessOrientationCallback(orientation)
{
    switch(orientation.status)
    {
      case 'PORTRAIT_PRIMARY':
           console.log("hai in portrait primary" );
           break ;
           
       case 'PORTRAIT_SECONDARY':
           console.log("hai in portrait secondary" );
           console.log(" Device current Orientation " + "portrait-secondary" );
           break ;
           
       case 'LANDSCAPE_PRIMARY':
           console.log("hai in landscape primary" );
           console.log(" Device current Orientation " + "landscape-primary" );//Reverse landscape in emulator
           break ;
           
       case 'LANDSCAPE_SECONDARY':
           console.log("hai in landscape secondary" );

}

}

Please refer the below link for more details 

https://developer.tizen.org/forums/web-application-development/about-orientation.sos...