Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to disable the android wear back swipe?

Tags:

wear-os

I am creating a Android Wear app that has an touch area. The user is suppose to be able to move it's finger in all directions over the screen (Think touchpad on your laptop). However the back swipe makes this a bit problematic. Any help with getting around this issue would be a great help.

How to disable the android wear back swipe?

/Jakob

like image 678
ui-jakob Avatar asked Jul 16 '14 08:07

ui-jakob


People also ask

How do I turn off screen swipe?

From the Home screen, tap the Apps Key > Settings > Lock screen. Tap Select screen lock. Tap None, Swipe, Face Unlock, Pattern, PIN, or Password.

How do I change swipe settings on Android?

From the top of your screen, swipe down twice. At the bottom left, tap Edit . Touch and hold the setting. Then drag the setting to where you want it.


2 Answers

There is an attribute in window style to disable this behavior:

<style name="AppTheme" parent="@android:style/Theme.DeviceDefault.Light">
    <item name="android:windowSwipeToDismiss">false</item>
</style>

Once you disable it you have to provide other way of exiting your app.
There is a DismissOverlayView class (listed here https://developer.android.com/training/wearables/apps/layouts.html#UiLibrary) that you should use instead.
Basically it provides an overlay that will show a red button with cross after a long press. Clicking the red button will exit your app.
enter image description here

Here is a video from Google I/O 2014 with some bookmarked moments:
https://www.youtube.com/watch?v=sha_w3_5c2c#t=1390 <- disabling android:windowSwipeToDismiss
https://www.youtube.com/watch?v=sha_w3_5c2c#t=1505 <- Java code for DismissOverlayView

You can also check another video called:
Fullscreen apps for Android Wear:
https://www.youtube.com/watch?v=naf_WbtFAlY

like image 140
Maciej Ciemięga Avatar answered Sep 20 '22 21:09

Maciej Ciemięga


You can try to write AndroidManifest.xml theme

android:theme="@style/Theme.Wearable.Modal inside activity tag

<activity
            android:name="com.smart.remote.wear.MainActivity"
            android:label="@string/app_name"
            android:theme="@style/Theme.Wearable.Modal">
like image 44
elifekiz Avatar answered Sep 20 '22 21:09

elifekiz