Skip to content

abactivity中一个地方,有点想法 #3

@lf951515851

Description

@lf951515851
public void setContentView(int layoutResID) {
        super.setContentView(layoutResID);
        initIocView();
    }

public void setAbContentView(View contentView) {
        contentLayout.removeAllViews();
        contentLayout.addView(contentView,new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
        //ioc
        initIocView();
    }

中都有initIocView();在实践开发中如果这样:

protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);//父类方法中会调用setContentView
        setAbContentView(R.layout.activity_main);
    }

就会调用两次initIocView();如果界面定义的iocview比较多的话,性能会有较大影响

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions