2010-03-28 134 views

回答

6

你可以用下面的示例嘗試...

if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) { 
    // You can set the value initially by 
    // ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED. Once set it 
    // retains it's value. The View will be rendered in the specified 
    // orientation using the code below. 
    setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); 
} 
10

試試這個

ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE 
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT 

檢查this進一步參考

+0

你如何旋轉屏幕在模擬器中? – Pentium10 2010-03-28 09:29:56

+3

數字鍵盤上的Home和PageUp,但請確保先關閉numlock。 – 2010-03-28 10:31:15

+0

OSX上的Ctrl + F11 :) – systempuntoout 2010-05-19 09:13:12

相關問題