开发者

How to change orientation of the screen permamently

Im wondering how 开发者_运维技巧i can change the orientation of the screen permanently (my app run in background and change the orientation to all applications, just like i flip phone). Please, help.


Not possible. Each app runs in a sandbox and you have no say over what happens to any other app. You can make requests via intents but not like what you're trying to do. The only way would be to get the Android source and modify it to change the orientation.


Normally this is controlled/exposed by your videocard drivers.

In some cases you may have to go down to the chipset level in order to find the right application (for example, on the HP thin-clients that I've got, this isn't available in the default drivers, but if I download additional (non-supported) software from the chipset vendor, they include a tool that lets you do this).

You can also give tools like iRotate a show and see if it does what you need.


If you only want to flip your application use this:

public void switchOrientation() {
    if(this.getRequestedOrientation() == ActivityInfo.SCREEN_ORIENTATION_PORTRAIT){
    this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT);
    } else{
        this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
    }

}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜