|
1、RelativeLayout相对布局
2、FrameLayout帧布局
- private void loadPageData(int position, boolean needlLoadData) {
- if (mViewHolders == null) {
- return;
- }
- AbsMainViewHolder vh = mViewHolders[position];
- if (vh == null) {
- if (mViewList != null && position < mViewList.size()) {
- FrameLayout parent = mViewList.get(position);
- if (parent == null) {
- return;
- }
- if (position == 0) {
- mHomeViewHolder = new MainHomeViewHolder(mContext, parent);
- mHomeViewHolder.setAppBarLayoutListener(this);
- vh = mHomeViewHolder;
- } else if (position == 1) {
- mActiveViewHolder = new MainActiveViewHolder(mContext, parent);
- mActiveViewHolder.setAppBarLayoutListener(this);
- vh = mActiveViewHolder;
- } else if (position == 2) {
- mMallViewHolder = new MainMallViewHolder(mContext, parent);
- vh = mMallViewHolder;
- } else if (position == 3) {
- mMeViewHolder = new MainMeViewHolder(mContext, parent);
- vh = mMeViewHolder;
- }
- if (vh == null) {
- return;
- }
- mViewHolders[position] = vh;
- vh.addToParent();
- vh.subscribeActivityLifeCycle();
- }
- }
- if (needlLoadData && vh != null) {
- vh.loadData();
- }
- }
复制代码
|
|