水平居中显示标题
@Overrideprotected void onLayout(boolean changed, int l, int t, int r, int b) { super.onLayout(changed, l, t, r, b); if (changed || mWidth == 0) { Rect rect = new Rect(); getWindowVisibleDisplayFrame(rect); mWidth = rect.right; } int marginLeft = (mWidth- l - r)/2;// 中点位移 for (int i = 0,count = getChildCount(); i < count; i++) { getChildAt(i).setLeft(marginLeft); }}