如何在片段 XML 中使用自定义组件



如何在片段中使用以下组件?https://github.com/hongyangAndroid/Android-CircleMenu

您链接到的源代码在onLayout()中包含以下行:

float angleDelay = 360 / (getChildCount() - 1);

您很有可能只提供了一个孩子:

float angleDelay = 360 / (getChildCount() - 1);
                 = 360 / (1 - 1);
                 = 360 / 0;

这将导致抛出ArithmeticException

在库的示例中,他们写道:

mCircleMenuLayout.setMenuItemIconsAndTexts(mItemImgs, mItemTexts);

确保每个数组至少有两个元素。

最新更新