子View位置顯示的不正確
為什么我寫出來的子View的圖標(biāo)是重疊的啊
private ?void getChild() {
? ?int count = getChildCount();
? ?for (int i = 0; i < count - 1; i++) {
? ? ? ?View child = getChildAt(i + 1);
? ? ? ?int l = (int) (mRadius * Math.sin(Math.PI / 2 / (count - 2) * i));
? ? ? ?int t = (int) (mRadius * Math.cos(Math.PI / 2 / (count - 2) * i));
? ? ? ?int width = child.getMeasuredWidth();
? ? ? ?int height = child.getMeasuredHeight();
? ? ? ?// 如果菜單位置在底部 左下,右下
? ? ? ?if (mPosition == Position.LEFT_BOTTOM || mPosition == Position.RIGHT_BOTTOM) {
? ? ? ? ? ?t = getMeasuredHeight() - height - t;
? ? ? ?}
? ? ? ?// 右上,右下
? ? ? ?if (mPosition == Position.RIGHT_TOP || mPosition == Position.RIGHT_BOTTOM) {
? ? ? ? ? ?l = getMeasuredWidth() - width - l;
? ? ? ?}
? ? ? ?child.layout(l, t, l + width, t + height);
? ?}
}
2018-11-01
我也是?
2016-05-10
叫截圖看看。