I did try this but did not work. Do I have to do more? Or is there another easy way?
Asked
Active
Viewed 307 times
1
-
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 Answers
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
-
where is the style.xml file located ? or do i have to create the file ? Same question for the manifestfile. – Kerbal Space Program Germany Feb 01 '23 at 20:30
-
style file is located in values folder which u can see in the image you have uploaded and manifest file is in the manifest folder – Pranay Feb 02 '23 at 06:13
-
style wasn't a premade file by the android studio. i did add this on my own. is she there right ? – Kerbal Space Program Germany Feb 02 '23 at 08:49
-
you have created style file in the string folder, try to create the file in the values folder then it will work – Pranay Feb 03 '23 at 09:04
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