Android全屏佩戴5.0.1活动

时间:2014-12-17 08:21:19

标签: android-activity android-5.0-lollipop wear-os android-fullscreen

自5.0.1更新后我遇到了问题。我对moto 360的活动不再采取全屏(光传感器不属于活动的一部分)了,我现在有了这个屏幕:

moto360 screen

我尝试添加一些标志:

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN);
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_INSET_DECOR);

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_IN_OVERSCAN);

    getWindow().addFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMIT);

在我的清单上:

        <activity
            android:theme="@android:style/Theme.DeviceDefault.NoActionBar"
            android:name=".activity.DreamActivity"
            android:excludeFromRecents="true"
            android:noHistory="true"
            android:label="${watchfaceName}"
            android:screenOrientation="reversePortrait">
            <intent-filter>
                <action android:name="android.intent.action.MAIN"/>
            </intent-filter>
        </activity>

但没有运气:(任何人都有这个问题?或者更好的解决方案?:) 当然我的活动布局设置为match_parent

1 个答案:

答案 0 :(得分:0)

这是我的工作解决方案,也许有更好的方法(也许是一个安卓漏洞?)...

我有我的基本布局并添加一个rotation = 90

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
                xmlns:custom="http://schemas.android.com/apk/res-auto"
                android:background="@color/black"
                android:id="@+id/main"
                android:rotation="90"
                android:padding="5dp"
                android:gravity="center"
                android:layout_width="match_parent"
                android:layout_height="match_parent">

    <com.jaumard.commonlibrary.views.DigitalClock
        android:id="@+id/watchface"
        custom:onWatch="true"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    </com.jaumard.commonlibrary.views.DigitalClock>
    <View
        android:id="@+id/dim"
        android:background="#AA000000"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>
</RelativeLayout>

在我的清单上,我删除了之前的android:screenOrientation="reversePortrait"