abhishek
abhishek

Reputation: 817

How to disable android wear back swipe for core android apps?

I am running a simple android app in my android wear Lg G watch. It is not an android wear app. So when I try to do it like this answer How to disable the android wear back swipe? , I get errors saying "Error: No resource found that matches the given name Theme.DeviceDefault" and "Error: No resource found that matches the given name attr: android:windowSwipeToDismiss" . My target sdk is 18. Is there a way I can disable the back swipe in this case?

Upvotes: 1

Views: 1107

Answers (1)

gruszczy
gruszczy

Reputation: 42208

You should use target sdk 21, which is on all Android Wear devices.

Follow the advice from the previous question, which is:

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

You need the sdk 21, because windowSwipeToDismiss wasn't introduced yet in 18. I believe this attr was introduced in 20, but since all wear devices have api level 21, it doesn't make sense to use the earlier one. Enjoy using most recent APIs ;-)

Upvotes: 2

Related Questions