Is it possible to programmatically determine the shape of the Adnroid Wear display, i.e. Is the screen round or square (rectangular)?
1 answer
According to developer.android.com :
Android Wearallows you to determine the shape of the screen at run time. To determine whether the screen is square or round, override theonApplyWindowInsets()method in theCanvasWatchFaceService.Engineclass as follows:
private class Engine extends CanvasWatchFaceService.Engine { boolean mIsRound; int mChinSize; @Override public void onApplyWindowInsets(WindowInsets insets) { super.onApplyWindowInsets(insets); mIsRound = insets.isRound(); mChinSize = insets.getSystemWindowInsetBottom(); } ... } |