Android Question Setting Style/Theme Items


Well-Known Member
Licensed User
I am developing an Android Wear app with B4A.

I'm having great success except for one thing – the swipe to dismiss gesture.

I am scrolling an image left/right/up/down on the Wear device screen. It all works except when I try to move the image to the right. Android thinks I'm doing a Swipe-To-Dismiss gesture and wants to exit the app.

I have the following code from an Android site:

<style name="AppTheme" parent="@android:style/Theme.DeviceDefault.Light">
    <item name="android:windowSwipeToDismiss">false</item>
I'm hoping that this can be put into the Manifest in some way. I have the following code from one of the Wear examples on this forum:

SetApplicationAttribute(android:theme, "@android:style/Theme.DeviceDefault.Light")
In my feeble attempt, I tried the following, but it complains there is no such attribute: android:windowSwipeToDismiss

SetApplicationAttribute(android:windowSwipeToDismiss, "false")
Is there a way I disable the SwipeToDismiss gesture on an Android Wear device?

Last edited:

Tim Green

Licensed User
My first wearable app, which is to be used on the round Moto360 watch, has a circular slider to allow the user to adjust a value. The Android wearable default slide-right-to-dismiss behavior was a show-stopper for this app. After an embarrassing about of time and effort spent in online research and trial and error testing I found this solution:

Step 1) The minimum API level set in the Manifest must be 20 or higher. The windowSwipeToDismiss item did not exist prior to this:

<uses-sdk android:minSdkVersion="20" android:targetSdkVersion="22"/>
<uses-feature android:name=""/>)
Step 2) Another change to the Manifest (use Manifest editor) is for the “Theme”:

Step 3) The above directs the build towards a styles.xml file which needs to be added to your B4A project. Create a folder named “values” at:

\your project folder name\Objects\res\values\

Put styles.xml file into this folder and write-protect the file. Write-protecting the file prevents the styles.xml file as well as the values folder from being removed during the B4A build process. The windowSwipeToDismiss item is set to false in this file.

styles.xml file content:

    <style name="AppTheme" parent="android:Theme.DeviceDefault">
        <item name="android:windowSwipeToDismiss">false</item>
With these changes, build and download your app to a wearable device and it will no longer be “swipe-to-dismiss” enabled.

I have to confess I remain confused by the “rules” for certain parts of the xml syntax as well as how B4A/Android determines which folders and files are used during the build. At least I am beginning to know the boundaries of my ignorance. As a B4A newbie, finding that so far it has no limitations in the kinds of applications for which it can be used and that for me it is the most productive Android app development environment is very gratifying.