androidwear-oswatch-face-api

System indicators do not respect Gravity.BOTTOM


I have taken the demo analog watch face, and tried getting the system indicators to appear at the bottom, using setStatusBarGravity(Gravity.BOTTOM). It appears that this particular gravity isn't respected.

setWatchFaceStyle(new WatchFaceStyle.Builder(AnalogWatchFace.this)
        .setCardPeekMode(WatchFaceStyle.PEEK_MODE_SHORT)
        .setBackgroundVisibility(WatchFaceStyle.BACKGROUND_VISIBILITY_INTERRUPTIVE)
        .setShowSystemUiTime(false)
        .setStatusBarGravity(Gravity.BOTTOM)
        .setHotwordIndicatorGravity(Gravity.BOTTOM)
        .build());

By setting it to this value, the indicators (and the "Ok Google" hotword indicator) appear in the center of the screen. On circular devices, they appear completely centered, on square devices vertically centered on the left.

I'm aware of an issue on Android Wear that the indicators aren't updated between relaunches of the app, but I've tried switching watch faces and even reinstalling it altogether. I've also tried using setStatusBarGravity() combining with a horizontal alignment with a binary OR, but only the horizontal gravity is respected for square devices.

Any idea what the problem might be?


Solution

  • It seems that Gravity.BOTTOM is a bit misleading; the vertical alignment is not at the bottom of the screen, but in the bottom-most of some preset positions.

    The position of the indicators appears to be relative; above any possible peeking cards and above the hotword indicator, if it is also set to Gravity.BOTTOM.

    I found that if I set setHotwordIndicatorGravity(Gravity.CENTER), the system indicators appear slightly lower than setting both indicators to Gravity.BOTTOM. It's not ideal, but it's the best I could get. This no longer appears to be the case in Wear OS.

    I've calculated the positions against a 390px circular display as:

    Gravity of status bar icons