Android 对象重用注意点
好了,思想加代码
View view=mainView.setItemText(text)
.setFragment(fragments)
.setFragmentTransaction(getSupportFragmentManager().beginTransaction())
.setItemUnCheckMipmap(mipmap)
.setItemCheckMipmap(mipmapCheck)
.setItemCheckTextColor(R.color.black)
.setItemUnCheckTextColor(R.color.line)
.setItemBackgroundColor(R.color.white)
.setIds(ids)
.setOnItemIdClickListener(this)
.setImagePadding(0,20,0,5)
.setTextPadding(0,5,0,10)
.setDefaultCheck(false)
.initView()
除了每次返回对象外,例如:
public MainView setIds(int[] ids) {
this.ids = ids;
return this;
}
特别注意:
public MainView(Context context) {
this.context = context;
return;
}
构造函数里还要 return;