如何在可穿戴设备的启动器中实现相同的可滚动菜单?

问题描述

enter image description here

我正在尝试创建一个类似于图片中的可滚动菜单我看到了一些类似的帖子或问题,但我一直无法取得任何结果。作为可穿戴设备启动器的弯曲可滚动菜单看起来像图片中的那个,那么我如何实现同样的事情,但我的应用程序呢?我需要做什么?

我的应用基本上有一个设置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 (将#修改为@)

相关问答

Selenium Web驱动程序和Java。元素在(x,y)点处不可单击。其...
Python-如何使用点“。” 访问字典成员?
Java 字符串是不可变的。到底是什么意思?
Java中的“ final”关键字如何工作?(我仍然可以修改对象。...
“loop:”在Java代码中。这是什么,为什么要编译?
java.lang.ClassNotFoundException:sun.jdbc.odbc.JdbcOdbc...