子view 没有一个显示的
主按钮可以正常显示,但是子按钮没有一个显示的这是什么情况,求解答
protected void onLayout(boolean changed, int l, int t, int r, int b) {
if (changed){
layoutMainButton();
int count = getChildCount();
Log.d(TAG, "onLayout: count is"+count);
for (int i =0 ;i<count-1;i++){
View child = getChildAt(i+1);
int cl = (int) (mRadius*Math.sin(Math.PI/2/(count-2)*i));
int ct = (int) (mRadius*Math.cos(Math.PI/2/(count-2)*i));
Log.d(TAG, "onLayout: cl is "+ cl+" , ct is" +ct);
int cwidth = child.getMeasuredWidth();
int cheight = child.getMeasuredHeight();
//如果在左下或者是右下
if (mPosition == Position.LEFT_BOTTOM || mPosition ==
Position.RIGHT_BOTTOM){
ct = getMeasuredHeight()- cheight-ct;
}
if(mPosition == Position.RIGHT_TOP || mPosition ==
Position.RIGHT_BOTTOM){
cl = getMeasuredWidth() - cwidth -cl;
}
child.layout(cl,ct,cl+cwidth,cl+cheight);
}
}
}
