问题描述
我正在尝试创建一个类似于图片中的可滚动菜单我看到了一些类似的帖子或问题,但我一直无法取得任何结果。作为可穿戴设备启动器的弯曲可滚动菜单看起来像图片中的那个,那么我如何实现同样的事情,但我的应用程序呢?我需要做什么?
我的应用基本上有一个设置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 (将#修改为@)