当前位置: 首页>>代码示例>>Java>>正文


Java FrameLayout.addView方法代码示例

本文整理汇总了Java中android.widget.FrameLayout.addView方法的典型用法代码示例。如果您正苦于以下问题:Java FrameLayout.addView方法的具体用法?Java FrameLayout.addView怎么用?Java FrameLayout.addView使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.widget.FrameLayout的用法示例。


在下文中一共展示了FrameLayout.addView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onException

import android.widget.FrameLayout; //导入方法依赖的package包/类
@Override
public void onException(NestedContainer container, String errCode, String msg) {
  if (TextUtils.equals(errCode, WXRenderErrorCode.WX_NETWORK_ERROR) && container instanceof WXEmbed) {
    final WXEmbed comp = ((WXEmbed)container);
    final ImageView imageView = new ImageView(comp.getContext());
    imageView.setImageResource(R.drawable.error);
    FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(ERROR_IMG_WIDTH, ERROR_IMG_HEIGHT);
    layoutParams.gravity = Gravity.CENTER;
    imageView.setLayoutParams(layoutParams);
    imageView.setScaleType(ImageView.ScaleType.FIT_XY);
    imageView.setAdjustViewBounds(true);
    imageView.setOnClickListener(new View.OnClickListener() {
      @Override
      public void onClick(View v) {
        imageView.setOnClickListener(null);
        imageView.setEnabled(false);
        comp.loadContent();
      }
    });
    FrameLayout hostView = comp.getHostView();
    hostView.removeAllViews();
    hostView.addView(imageView);
    WXLogUtils.e("WXEmbed", "NetWork failure :" + errCode + ",\n error message :" + msg);
  }
}
 
开发者ID:erguotou520,项目名称:weex-uikit,代码行数:26,代码来源:WXEmbed.java

示例2: ChatUnreadCell

import android.widget.FrameLayout; //导入方法依赖的package包/类
public ChatUnreadCell(Context context) {
    super(context);

    FrameLayout frameLayout = new FrameLayout(context);
    //frameLayout.setBackgroundResource(R.drawable.newmsg_divider);
    addView(frameLayout, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, 27, Gravity.LEFT | Gravity.TOP, 0, 7, 0, 0));

    ImageView imageView = new ImageView(context);
    imageView.setImageResource(R.drawable.ic_ab_new);
    imageView.setPadding(0, AndroidUtilities.dp(2), 0, 0);
    frameLayout.addView(imageView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.RIGHT | Gravity.CENTER_VERTICAL, 0, 0, 10, 0));

    textView = new TextView(context);
    textView.setTypeface(FontManager.instance().getTypeface());
    textView.setPadding(0, 0, 0, AndroidUtilities.dp(1));
    textView.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 14);
    textView.setTextColor(Theme.CHAT_UNREAD_TEXT_COLOR);
    textView.setTypeface(FontManager.instance().getTypeface());
    addView(textView, LayoutHelper.createFrame(LayoutHelper.WRAP_CONTENT, LayoutHelper.WRAP_CONTENT, Gravity.CENTER));

    ColorUtils.ColorPresenter c= ChitSettings.currentColorPresenter();
    try {
        c.modifyUnreadBg(frameLayout, textView);
    }catch (Exception e){}

}
 
开发者ID:MLNO,项目名称:airgram,代码行数:27,代码来源:ChatUnreadCell.java

示例3: onCreate

import android.widget.FrameLayout; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                       WindowManager.LayoutParams.FLAG_FULLSCREEN);
  FrameLayout layout = new FrameLayout(this);
  TextView help_view = new TextView(this);
  help_view.setTextSize(18);
  help_view.setBackgroundColor(0xFFFFFFFF);
  help_view.setTextColor(0xFF000000);
  help_view.setText(R.string.help);
  ScrollView scroll_view = new ScrollView(this);
  scroll_view.setBackgroundColor(0xFFFFFFFF);
  scroll_view.addView(help_view);
  layout.addView(scroll_view);
  setContentView(layout);
}
 
开发者ID:sdrausty,项目名称:buildAPKsApps,代码行数:18,代码来源:Help.java

示例4: initComponentHostView

import android.widget.FrameLayout; //导入方法依赖的package包/类
@Override
protected FrameLayout initComponentHostView(@NonNull Context context) {
  FrameLayout view = new FrameLayout(context);
  // init view pager
  if (getDomObject() != null && getDomObject().getAttrs() != null) {
    Object obj = getDomObject().getAttrs().get(INFINITE);
    isInfinite = WXUtils.getBoolean(obj, true);
  }
  FrameLayout.LayoutParams pagerParams = new FrameLayout.LayoutParams(
      LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
  mViewPager = new WXCircleViewPager(context);
  mViewPager.setCircle(isInfinite);
  mViewPager.setLayoutParams(pagerParams);

  // init adapter
  mAdapter = new WXCirclePageAdapter(isInfinite);
  mViewPager.setAdapter(mAdapter);
  // add to parent
  view.addView(mViewPager);
  mViewPager.addOnPageChangeListener(mPageChangeListener);

  registerActivityStateListener();

  return view;
}
 
开发者ID:weexext,项目名称:ucar-weex-core,代码行数:26,代码来源:WXSlider.java

示例5: setEmptyView

import android.widget.FrameLayout; //导入方法依赖的package包/类
public final void setEmptyView(View newEmptyView) {
    FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();
    if (newEmptyView != null) {
        newEmptyView.setClickable(true);
        ViewParent newEmptyViewParent = newEmptyView.getParent();
        if (newEmptyViewParent != null && (newEmptyViewParent instanceof ViewGroup)) {
            ((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
        }
        LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
        if (lp != null) {
            refreshableViewWrapper.addView(newEmptyView, lp);
        } else {
            refreshableViewWrapper.addView(newEmptyView);
        }
    }
    if (this.mRefreshableView instanceof EmptyViewMethodAccessor) {
        ((EmptyViewMethodAccessor) this.mRefreshableView).setEmptyViewInternal(newEmptyView);
    } else {
        ((AbsListView) this.mRefreshableView).setEmptyView(newEmptyView);
    }
    this.mEmptyView = newEmptyView;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:23,代码来源:PullToRefreshAdapterViewBase.java

示例6: handleStyledAttributes

import android.widget.FrameLayout; //导入方法依赖的package包/类
protected void handleStyledAttributes(TypedArray a) {
    super.handleStyledAttributes(a);
    this.mListViewExtrasEnabled = a.getBoolean(R.styleable
            .PullToRefresh_ptrListViewExtrasEnabled, true);
    if (this.mListViewExtrasEnabled) {
        LayoutParams lp = new LayoutParams(-1, -2, 1);
        FrameLayout frame = new FrameLayout(getContext());
        this.mHeaderLoadingView = createLoadingLayout(getContext(), Mode.PULL_FROM_START, a);
        this.mHeaderLoadingView.setVisibility(8);
        frame.addView(this.mHeaderLoadingView, lp);
        ((ListView) this.mRefreshableView).addHeaderView(frame, null, false);
        this.mLvFooterLoadingFrame = new FrameLayout(getContext());
        this.mFooterLoadingView = createLoadingLayout(getContext(), Mode.PULL_FROM_END, a);
        this.mFooterLoadingView.setVisibility(8);
        this.mLvFooterLoadingFrame.addView(this.mFooterLoadingView, lp);
        if (!a.hasValue(R.styleable.PullToRefresh_ptrScrollingWhileRefreshingEnabled)) {
            setScrollingWhileRefreshingEnabled(true);
        }
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:21,代码来源:PullToRefreshListView.java

示例7: setEmptyView

import android.widget.FrameLayout; //导入方法依赖的package包/类
/**
 * Sets the Empty View to be used by the Adapter View.
 * <p/>
 * We need it handle it ourselves so that we can Pull-to-Refresh when the
 * Empty View is shown.
 * <p/>
 * Please note, you do <strong>not</strong> usually need to call this method
 * yourself. Calling setEmptyView on the AdapterView will automatically call
 * this method and set everything up. This includes when the Android
 * Framework automatically sets the Empty View based on it's ID.
 * 
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView) {
	FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();

	if (null != newEmptyView) {
		// New view needs to be clickable so that Android recognizes it as a
		// target for Touch Events
		newEmptyView.setClickable(true);

		ViewParent newEmptyViewParent = newEmptyView.getParent();
		if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
			((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
		}

		// We need to convert any LayoutParams so that it works in our
		// FrameLayout
		FrameLayout.LayoutParams lp = convertEmptyViewLayoutParams(newEmptyView.getLayoutParams());
		if (null != lp) {
			refreshableViewWrapper.addView(newEmptyView, lp);
		} else {
			refreshableViewWrapper.addView(newEmptyView);
		}
	}

	if (mRefreshableView instanceof EmptyViewMethodAccessor) {
		((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
	} else {
		mRefreshableView.setEmptyView(newEmptyView);
	}
	mEmptyView = newEmptyView;
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:44,代码来源:PullToRefreshAdapterViewBase.java

示例8: attach

import android.widget.FrameLayout; //导入方法依赖的package包/类
public void attach(FrameLayout root) {
    if (root != null && getParent() == null) {
        LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT,
                LayoutParams.WRAP_CONTENT);
        params.gravity = Gravity.BOTTOM;
        params.setMargins(4, 4, 4, 4);
        root.addView(this, params);
        Animation rotationAni = AnimationUtils.loadAnimation(getContext(), R.anim.slide_in_from_bottom);
        startAnimation(rotationAni);
    }
}
 
开发者ID:garena,项目名称:dev-alert-android,代码行数:12,代码来源:DevAlertHintView.java

示例9: showProgress

import android.widget.FrameLayout; //导入方法依赖的package包/类
public static ProgressBar showProgress(Context context, FrameLayout layout) {
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
    params.gravity = Gravity.CENTER;
    ProgressBar bar = new ProgressBar(context);
    bar.setLayoutParams(params);
    layout.addView(bar);
    return bar;
}
 
开发者ID:hh-in-zhuzhou,项目名称:ShangHanLun,代码行数:9,代码来源:Helper.java

示例10: inflateLoadLayout

import android.widget.FrameLayout; //导入方法依赖的package包/类
/**
     * 布局inflate
     */
    protected View inflateLoadLayout(FrameLayout baseRootLayout, LayoutInflater inflater) {
//        return inflater.inflate(R.layout.base_load_layout, baseRootLayout);
        EmptyView emptyView = new EmptyView(mActivity);
        int padding = (int) ResUtil.dpToPx(mActivity, 20);
        emptyView.setPadding(padding, padding, padding, padding);
        baseRootLayout.addView(emptyView, new ViewGroup.LayoutParams(-1, -1));
        return emptyView;
    }
 
开发者ID:angcyo,项目名称:RLibrary,代码行数:12,代码来源:UIBaseView.java

示例11: onCreateView

import android.widget.FrameLayout; //导入方法依赖的package包/类
private void onCreateView(Bundle savedInstanceState) {
    this.saveInstanceState = savedInstanceState;
    boolean isVisible;
    if (isVisibleToUserState == STATE_NO_SET) {
        isVisible = getUserVisibleHint();
    } else {
        isVisible = isVisibleToUserState == STATE_VISIBLE;
    }
    if (isLazyEnable) {
        if (isVisible && !isInitReady) {
            onCreateViewLazy(savedInstanceState);
            isInitReady = true;
        } else {
            LayoutInflater mInflater = layoutInflater;
            if (mInflater == null && context != null) {
                mInflater = LayoutInflater.from(context);
            }
            layout = new FrameLayout(context);
            layout.setTag(TAG_ROOT_FRAMELAYOUT);

            View view = getPreviewLayout(mInflater, layout);
            if (view != null) {
                layout.addView(view);
            }
            layout.setLayoutParams(
                    new FrameLayout.LayoutParams(
                            ViewGroup.LayoutParams.MATCH_PARENT,
                            ViewGroup.LayoutParams.MATCH_PARENT));
            setContentView(layout);
        }
    } else {
        onCreateViewLazy(savedInstanceState);
        isInitReady = true;
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:36,代码来源:LazyFragment.java

示例12: onSuccessState

import android.widget.FrameLayout; //导入方法依赖的package包/类
/**
 * 加载成功,显示内容
 */
@DoMain
public void onSuccessState() {
    FrameLayout contains = (FrameLayout) rootView.findViewById(R.id.state_contains);
    contains.removeAllViews();
    contains.addView(View.inflate(this.getContext(), setSuccessViewId(), null));
    onSuccessed();
}
 
开发者ID:penghongru,项目名称:Coder,代码行数:11,代码来源:StateFragment.java

示例13: initToolbar

import android.widget.FrameLayout; //导入方法依赖的package包/类
private void initToolbar() {
    Button mToolbarButton = (Button) findViewById(R.id.tool_bar_button);
    mToolbarButton.setVisibility(View.GONE);
    ImageButton mSearchButton = (ImageButton) findViewById(R.id.search_button);
    mSearchButton.setVisibility(View.GONE);

    TextView mTitleText = (TextView) findViewById(R.id.title_text);
    mTitleText.setText("每日编辑精选");
    mTitleText.setTextSize(16);
    mTitleText.setTypeface(Typeface.createFromAsset(getAssets(), getString(R.string.DB1FontPath)));

    mToolbar = (Toolbar) findViewById(R.id.tool_bar);
    ImageButton mExitButton = new ImageButton(this);
    mExitButton.setBackgroundResource(R.drawable.ic_action_back_black);
    FrameLayout frameLayout = (FrameLayout) findViewById(R.id.tool_bar_layout);
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(100, 120);
    params.gravity = Gravity.CENTER_VERTICAL;
    params.leftMargin = 10;
    frameLayout.addView(mExitButton, params);

    setSupportActionBar(mToolbar);
    mExitButton.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            finish();
        }
    });
}
 
开发者ID:KnowledgeBegger,项目名称:MyEyepetizer,代码行数:29,代码来源:DailyActivity.java

示例14: getContentView

import android.widget.FrameLayout; //导入方法依赖的package包/类
/**
 * Returns the view that will be the root view of the dialog. We are wrapping this in a
 * FrameLayout because this is the system's way of notifying us that the dialog size has changed.
 * This has the pleasant side-effect of us not having to preface all Modals with
 * "top: statusBarHeight", since that margin will be included in the FrameLayout.
 */
private View getContentView() {
  FrameLayout frameLayout = new FrameLayout(getContext());
  frameLayout.addView(mHostView);
  frameLayout.setFitsSystemWindows(true);
  return frameLayout;
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:13,代码来源:ReactModalHostView.java

示例15: init

import android.widget.FrameLayout; //导入方法依赖的package包/类
public void init() {
    fl = new FrameLayout(getContext());
    fl.setTag("aah_fl");
    fab = new FloatingActionButton(getContext());
    fab.setTag("aah_fab");
    fab.setCompatElevation(0);
    fl.addView(fab);
    this.addView(fl);

}
 
开发者ID:Krupen,项目名称:FabulousFilter,代码行数:11,代码来源:AAH_FilterView.java


注:本文中的android.widget.FrameLayout.addView方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。