Toolbar Title layoutParams
ysmintor opened this issue · 2 comments
ysmintor commented
LayoutParams layoutParams = new LayoutParams(-2, -2, Gravity.CENTER_VERTICAL | Gravity.START);
从下面函数找到的,对于填入-2的依据是什么?
protected TextView getTitleView() {
if (titleView == null) {
titleView = new TextView(getContext());
LayoutParams layoutParams = new LayoutParams(-2, -2, Gravity.CENTER_VERTICAL | Gravity.START);
layoutParams.leftMargin = getContentInset();
addView(titleView, layoutParams);
}
return titleView;
}
listenzz commented
-2 就是 wrap_content
就是 ViewGroup.LayoutParams.WRAP_CONTENT
ysmintor commented
好的,了解了!