Wear OS ListView items don't hug the edge of the screen (circular watch face)
Opened this issue · 4 comments
Instead they follow a linear path between the center of the left side of the screen and the middle of the top or bottom of the screen. The WearOS app list view has each item following an arc that makes the items hug the side of the screen
I think this is because of this line which manually moves the children over using a linear function. Based on the wear os documentation I think WearableRecyclerView::setEdgeItemsCenteringEnabled(boolean) should be used instead?
Looking further - maybe not :/ see this post about needing a custom function
After much fiddling I've found that the code below allows you to control how much the items hug the side of the screen and that the value below of curveFactor = 0.5
approximately matches the behavior of the wearOS app menu when scaling is not applied, and curveFactor = 1.5
approximately matches the behavior of the wearOS app menu when scaling is applied
var middle = parent.getWidth() / 2.0;
var curveFactor = 0.5;
var start = 1.0 - curveFactor * Math.abs(yRelativeToCenterOffset - 0.5);
var x = (start - Math.sin(yRelativeToCenterOffset * Math.PI)) * middle;
child.setX(x);
I noticed this linear path too. Would love for this to be PR'd