Search code examples
android-activityandroid-5.0-lollipopwear-osandroid-fullscreen

Android wear 5.0.1 activity fullscreen


I have a problem since 5.0.1 update. My activity on moto 360 not taking full screen (light sensor is not part of the activity) anymore and I have now this screen :

moto360 screen

I try to add some flags :

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

Or

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

or

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

On my manifest :

        <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>

But no luck :( anyone have this problem ? Or even better a solution ? :) Of course my activity layout is set to match_parent


Solution

  • Here is my working solution, maybe there is a better way (maybe an android wear bug ?)...

    I have my basic layout and add a 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>
    

    And on my Manifest I remove the previous android:screenOrientation="reversePortrait"