//加载样式
TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.TitleBarView, defStyleAttr, 0);
String mainTitle = typedArray.getString(R.attr.main_title);
setTitle(mainTitle);
程序常常因为使用者没有设置main_title 而崩溃,但是对于 showBackView(typedArray.getBoolean(R.attr.show_back, false));
它是有默认值的,为何字符串没有
在你的自定义的style里,可以设置文字大小,文字颜色,那么文字呢?