溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊(cè)×
其他方式登錄
點(diǎn)擊 登錄注冊(cè) 即表示同意《億速云用戶服務(wù)條款》

Android 屏幕實(shí)現(xiàn)上下翻轉(zhuǎn)

發(fā)布時(shí)間:2020-08-23 12:17:38 來源:腳本之家 閱讀:240 作者:oracleot 欄目:移動(dòng)開發(fā)

Android 屏幕實(shí)現(xiàn)上下翻轉(zhuǎn)

通常我們的應(yīng)用只會(huì)設(shè)計(jì)成橫屏或者豎屏,鎖定橫屏或豎屏的方法是在manifest.xml文件中設(shè)定屬性android:screenOrientation為"landscape"或"portrait":

 <activity
      android:name="com.example.kata1.MainActivity"
      android:label="@string/app_name" 
      android:screenOrientation="landscape">
      <intent-filter>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.category.LAUNCHER" />
      </intent-filter>
    </activity>

其實(shí)screenOrientation還可以設(shè)置成很多值:

android:screenOrientation    =     ["unspecified" | "behind" |
                   "landscape" | "portrait" |
                   "reverseLandscape" | "reversePortrait" |
                   "sensorLandscape" | "sensorPortrait" |
                   "userLandscape" | "userPortrait" |
                   "sensor" | "fullSensor" | "nosensor" |
                   "user" | "fullUser" | "locked"]

其中sensorLandscape就是橫屏根據(jù)重力上下翻轉(zhuǎn),sensorPortrait豎屏根據(jù)重力上下翻轉(zhuǎn)。

如果有興趣,你也可以試試其他的值哦...

感謝閱讀,希望能幫助到大家,謝謝大家對(duì)本站的支持!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如果涉及侵權(quán)請(qǐng)聯(lián)系站長(zhǎng)郵箱:is@yisu.com進(jìn)行舉報(bào),并提供相關(guān)證據(jù),一經(jīng)查實(shí),將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI