如何解决如何在可穿戴设备的启动器中实现相同的可滚动菜单?
我正在尝试创建一个类似于图片中的可滚动菜单我看到了一些类似的帖子或问题,但我一直无法取得任何结果。作为可穿戴设备启动器的弯曲可滚动菜单看起来像图片中的那个,那么我如何实现同样的事情,但我的应用程序呢?我需要做什么?
我的应用基本上有一个设置Activity,包含:工具编号、模式、时间、流量
将它们视为类别,每个类别都有一组单选按钮,我想要的是按照与图片中相同的方式放置每个类别的图标,这样用户就可以轻松地滚动它们并在它们之间导航。
private void onLayoutInflated()
{
CustomScrollingLayoutCallback customScrollingLayoutCallback = new CustomScrollingLayoutCallback();
wearableRecyclerView.setLayoutManager(new Wearablelinearlayoutmanager(circular_menu_external.this,customScrollingLayoutCallback));
wearableRecyclerView.setEdgeItemsCenteringEnabled(true);
}
private class CustomScrollingLayoutCallback extends Wearablelinearlayoutmanager.LayoutCallback {
private static final float MAX_ICON_PROGRESS = 2F;
@Override
public void onLayoutFinished(View child,RecyclerView parent) {
float centerOffset = ((float) child.getHeight() / 2.0f) / (float) parent.getHeight();
float yRelativetoCenterOffset = (child.getY() / parent.getHeight()) + centerOffset;
float progresstoCenter = (float) Math.sin(yRelativetoCenterOffset * Math.PI);
float mProgresstoCenter = Math.abs(0.5f - yRelativetoCenterOffset);
mProgresstoCenter = Math.min(mProgresstoCenter,MAX_ICON_PROGRESS);
child.setScaleX(1 - mProgresstoCenter);
child.setScaleY(1 - mProgresstoCenter);
child.setX(+(1 - progresstoCenter) * 100);
}
}
代码来自这里:How to create Circular view on android wear?
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。