1

I did try this but did not work. Do I have to do more? Or is there another easy way?

enter image description here

TofferJ
  • 4,678
  • 1
  • 37
  • 49
  • Does this answer your question? [How to disable the android wear back swipe?](https://stackoverflow.com/questions/24775451/how-to-disable-the-android-wear-back-swipe) – TofferJ Jan 24 '23 at 22:06
  • You do need to make sure that your theme is being used by your activity. You can also check out this question for more details: https://stackoverflow.com/questions/24775451/how-to-disable-the-android-wear-back-swipe – TofferJ Jan 24 '23 at 22:07

2 Answers2

0

You can Modify your theme style. Add this to your style.xml file.

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

Then add theme style in your manifest file on targeted activity like this:

android:theme="@style/AppTheme"

This will disable swipe in the app or activity.

Pranay
  • 73
  • 1
  • 6
0

If you use Theme.AppCompat.Light it will make everything white.

Here is a way to do it on a newer device where you didn't add support libraries and also want to make it stay dark theme:

<resources>
    <style name="ThemeActivity" parent="android:Theme.DeviceDefault">
        <item name="android:windowSwipeToDismiss">false</item>
    </style>
</resources>
<activity
     android:name=".ui.MyActivity"
     android:exported="true"
     android:theme="@style/ThemeActivity">
</activity>

Disables swipe to close activity on a single activity.

DIRTY DAVE
  • 2,523
  • 2
  • 20
  • 83