当前位置: 首页>>代码示例>>Java>>正文


Java ActivityInfo.ScreenOrientation方法代码示例

本文整理汇总了Java中android.content.pm.ActivityInfo.ScreenOrientation方法的典型用法代码示例。如果您正苦于以下问题:Java ActivityInfo.ScreenOrientation方法的具体用法?Java ActivityInfo.ScreenOrientation怎么用?Java ActivityInfo.ScreenOrientation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.content.pm.ActivityInfo的用法示例。


在下文中一共展示了ActivityInfo.ScreenOrientation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getRequestedOrientation

import android.content.pm.ActivityInfo; //导入方法依赖的package包/类
/**
 * Return the current requested orientation of the activity.  This will
 * either be the orientation requested in its component's manifest, or
 * the last requested orientation given to
 * {@link #setRequestedOrientation(int)}.
 *
 * @return Returns an orientation constant as used in
 * {@link ActivityInfo#screenOrientation ActivityInfo.screenOrientation}.
 */
@ActivityInfo.ScreenOrientation
public int getRequestedOrientation() {
    if (mParent == null) {
        try {
            return ActivityManagerNative.getDefault()
                    .getRequestedOrientation(mToken);
        } catch (RemoteException e) {
            // Empty
        }
    } else {
        return mParent.getRequestedOrientation();
    }
    return ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED;
}
 
开发者ID:JessYanCoding,项目名称:ProgressManager,代码行数:24,代码来源:a.java

示例2: setRequestedOrientation

import android.content.pm.ActivityInfo; //导入方法依赖的package包/类
/**
 * Change the desired orientation of this activity.  If the activity
 * is currently in the foreground or otherwise impacting the screen
 * orientation, the screen will immediately be changed (possibly causing
 * the activity to be restarted). Otherwise, this will be used the next
 * time the activity is visible.
 *
 * @param requestedOrientation An orientation constant as used in
 * {@link ActivityInfo#screenOrientation ActivityInfo.screenOrientation}.
 */
public void setRequestedOrientation(@ActivityInfo.ScreenOrientation int requestedOrientation) {
    if (mParent == null) {
        try {
            ActivityManagerNative.getDefault().setRequestedOrientation(
                    mToken, requestedOrientation);
        } catch (RemoteException e) {
            // Empty
        }
    } else {
        mParent.setRequestedOrientation(requestedOrientation);
    }
}
 
开发者ID:JessYanCoding,项目名称:ProgressManager,代码行数:23,代码来源:a.java


注:本文中的android.content.pm.ActivityInfo.ScreenOrientation方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。