Example usage for android.support.v4.view ViewPager setBackgroundColor

List of usage examples for android.support.v4.view ViewPager setBackgroundColor

Introduction

In this page you can find the example usage for android.support.v4.view ViewPager setBackgroundColor.

Prototype

@RemotableViewMethod
public void setBackgroundColor(@ColorInt int color) 

Source Link

Document

Sets the background color for this view.

Usage

From source file:org.zywx.wbpalmstar.engine.EBrowserWindow.java

private void hMultiPopOverOpen(final ArrayList<EBrwViewEntry> entitys, final int index) {
    final ArrayList<EBounceView> viewList = new ArrayList<EBounceView>();
    EBrwViewEntry mainEntry = entitys.get(0);
    Log.d("multi", "entitys num:" + entitys.size());
    if (checkMultiPop(entitys)) {
        return;/*from  w w  w.ja  va  2 s.c o  m*/
    }
    EBrowserView parentBrowerview = new EBrowserView(mContext, mainEntry.mType, this);
    parentBrowerview.setVisibility(VISIBLE);
    parentBrowerview.setName(mainEntry.mViewName);
    parentBrowerview.setRelativeUrl(mainEntry.mRelativeUrl);
    parentBrowerview.setDateType(mainEntry.mDataType);
    LayoutParams newParm = new LayoutParams(mainEntry.mWidth, mainEntry.mHeight);
    // newParm.leftMargin = entity.mX;
    // newParm.topMargin = entity.mY;
    int parentRight = getRight();
    int parentBottom = getBottom();
    int newRight = mainEntry.mX + mainEntry.mWidth;
    if (newRight > parentRight) {
        newParm.rightMargin = parentRight - newRight;
    } else {
        newParm.rightMargin = 0;
    }
    int newBottom = mainEntry.mY + mainEntry.mHeight;
    if (newBottom > parentBottom) {
        newParm.bottomMargin = parentBottom - newBottom;
    } else if (0 == newBottom) {
        mainEntry.mY = mainEntry.mY + 1;
        newParm.bottomMargin = 0;
    } else {
        newParm.bottomMargin = 0;
    }
    newParm.topMargin = mainEntry.mY;
    newParm.leftMargin = mainEntry.mX;
    EBounceView bounceView = new EBounceView(mContext);
    EUtil.viewBaseSetting(bounceView);
    bounceView.setLayoutParams(newParm);
    bounceView.addView(parentBrowerview);
    addView(bounceView);
    if (mainEntry.hasExtraInfo) {
        /** wanglei del 20151124*/
        //            parentBrowerview.setBrwViewBackground(mainEntry.mOpaque, mainEntry.mBgColor, "");
        /** wanglei add 20151124*/
        bounceView.setBounceViewBackground(mainEntry.mOpaque, mainEntry.mBgColor, "", parentBrowerview);
    } else {
        if (mainEntry.checkFlag(EBrwViewEntry.F_FLAG_OPAQUE)) {
            parentBrowerview.setOpaque(true);
        } else {
            parentBrowerview.setOpaque(false);
        }
    }
    parentBrowerview.init();

    for (int i = 1; i < entitys.size(); i++) {
        EBrwViewEntry entity = entitys.get(i);
        EBrowserView childView = new EBrowserView(mContext, entity.mType, this);
        childView.setVisibility(VISIBLE);
        childView.setName(entity.mViewName);
        childView.setRelativeUrl(entity.mRelativeUrl);
        childView.setDateType(entity.mDataType);
        EBounceView bounceViewChild = new EBounceView(mContext);
        EUtil.viewBaseSetting(bounceViewChild);
        bounceViewChild.setLayoutParams(new LayoutParams(LayoutParams.FILL_PARENT, LayoutParams.FILL_PARENT));
        if (entity.hasExtraInfo) {
            /** wanglei del 20151124*/
            //                childView.setBrwViewBackground(entity.mOpaque, entity.mBgColor, "");
            /** wanglei add 20151124*/
            bounceViewChild.setBounceViewBackground(entity.mOpaque, entity.mBgColor, "", childView);
        }
        bounceViewChild.addView(childView);
        viewList.add(bounceViewChild);

    }
    BDebug.i("multi", "viewlist num:", viewList.size());
    LayoutParams pagerParm = new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT);
    ViewPager mPager = new ViewPager(mContext);
    mPager.setAdapter(new MultiPopAdapter(viewList));
    mPager.setCurrentItem(index);
    mPager.setOnPageChangeListener(new MyPageChangedListener(parentBrowerview.getName()));
    mPager.setLayoutParams(pagerParm);
    mPager.setBackgroundColor(Color.TRANSPARENT);
    parentBrowerview.addView(mPager);
    mMultiPopPager.put(parentBrowerview.getName(), mPager);
    final ArrayList<EBrowserView> list = new ArrayList<EBrowserView>();
    list.add(parentBrowerview);

    EBrowserView eBrowserView = loadOneOfMultiPop(viewList.get(index), entitys.get(index + 1), list);
    eBrowserView.setEBrowserViewChangeListener(new EBrowserView.OnEBrowserViewChangeListener() {
        @Override
        public void onPageFinish() {
            loadTheRestOfMultiPop(index, viewList, entitys, list);
        }
    });
    BDebug.i("multipop", index, "load...");
    mMultiPopTable.put(parentBrowerview.getName(), list);
}