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


Java ViewGroup.removeAllViews方法代码示例

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


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

示例1: buildContentView

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
protected View buildContentView(View view) {
	if (!isAddSpringView()) return view;

	ViewGroup parentView = getWindow().getDecorView().findViewById(android.R.id.content);
	parentView.removeAllViews();
	ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
			ViewGroup.LayoutParams.MATCH_PARENT);
	view.setLayoutParams(lp);

	mSpringView.setContentView(view);
	mSpringView.setHeader(new DefaultHeader(this));
	mSpringView.setFooter(new DefaultFooter(this));
	parentView.addView(mSpringView);

	return mSpringView;
}
 
开发者ID:wenqin-231,项目名称:StatusView,代码行数:18,代码来源:BaseLoadMoreActivity.java

示例2: changePacketSelection

import android.view.ViewGroup; //导入方法依赖的package包/类
private void changePacketSelection(@NonNull Packet packet) {
  final LayoutInflater inflater = getLayoutInflater();
  final ViewGroup formContainer = this.formContainer;
  TransitionManager.beginDelayedTransition(formContainer, new AutoTransition().setDuration(150));
  formContainer.removeAllViews();
  final PacketParameter[] parameters = packet.parameters;
  final int paramLen = parameters.length;
  for (int i = 0; i < paramLen; i++) {
    final PacketParameter param = parameters[i];
    final TextInputLayout inputLayout = (TextInputLayout) inflater.inflate(R.layout.input_field, formContainer, false);
    inputLayout.setTag(param);
    inputLayout.setHint(param.id());
    final EditText inputField = inputLayout.getEditText();
    if (inputField != null) {
      inputField.setText(param.value());
    }
    formContainer.addView(inputLayout);
  }
}
 
开发者ID:swedbank,项目名称:android-banklink,代码行数:20,代码来源:MainActivity.java

示例3: onException

import android.view.ViewGroup; //导入方法依赖的package包/类
@SuppressLint("SetJavaScriptEnabled")
@Override
public void onException(NestedContainer comp, String errCode, String msg) {
  //downgrade embed
  if( errCode != null && comp instanceof WXEmbed && errCode.startsWith("1|")) {
    ViewGroup container = comp.getViewContainer();
    WebView webView = new WebView(container.getContext());
    ViewGroup.LayoutParams params = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
    webView.setLayoutParams(params);
    webView.getSettings().setJavaScriptEnabled(true);

    container.removeAllViews();
    container.addView(webView);
    webView.loadUrl(((WXEmbed)comp).src);
  }else{
    super.onException(comp,errCode,msg);
  }
}
 
开发者ID:amap-demo,项目名称:weex-3d-map,代码行数:19,代码来源:WXEmbed.java

示例4: startChildActivity

import android.view.ViewGroup; //导入方法依赖的package包/类
public void startChildActivity(ViewGroup container, String key, Intent intent){
    //移除内容部分全部的View
    container.removeAllViews();
    intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

    Activity contentActivity = mLocalActivityManager.getActivity(key);
    if(contentActivity!=null) {
        container.addView(
                mLocalActivityManager.getActivity(key)
                        .getWindow().getDecorView(),
                new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
                        ViewGroup.LayoutParams.MATCH_PARENT));
        mLocalActivityManager.switchToChildActivity(key);
    }else{
        execStartChildActivityInternal(container, key, intent);
    }
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:18,代码来源:ActivityGroupDelegate.java

示例5: loadComponent

import android.view.ViewGroup; //导入方法依赖的package包/类
@BindingAdapter("component")
public static void loadComponent(ViewGroup viewGroup, MvvmComponent component) {
    if (component != null) {
        ViewDataBinding binding = DataBindingUtil.inflate(LayoutInflater.from(viewGroup.getContext()), component.getLayoutResId(), viewGroup, false);
        View view = binding.getRoot();
        binding.setVariable(BR.vm, component.getViewModel());
        binding.executePendingBindings();
        viewGroup.removeAllViews();
        viewGroup.addView(view);
    }
}
 
开发者ID:wongcain,项目名称:okuki,代码行数:12,代码来源:ViewGroupBindings.java

示例6: onWidgetsBound

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
protected void onWidgetsBound() {
    List<WidgetItem> widgets = mLauncher.getWidgetsForPackageUser(new PackageUserKey(
            mOriginalItemInfo.getTargetComponent().getPackageName(), mOriginalItemInfo.user));

    ViewGroup widgetRow = (ViewGroup) findViewById(R.id.widgets);
    ViewGroup widgetCells = (ViewGroup) widgetRow.findViewById(R.id.widgets_cell_list);

    widgetCells.removeAllViews();

    for (int i = 0; i < widgets.size(); i++) {
        WidgetCell widget = addItemCell(widgetCells);
        widget.applyFromCellItem(widgets.get(i), LauncherAppState.getInstance(mLauncher)
                .getWidgetCache());
        widget.ensurePreview();
        widget.setVisibility(View.VISIBLE);
        if (i < widgets.size() - 1) {
            addDivider(widgetCells);
        }
    }

    if (widgets.size() == 1) {
        // If there is only one widget, we want to center it instead of left-align.
        WidgetsBottomSheet.LayoutParams params = (WidgetsBottomSheet.LayoutParams)
                widgetRow.getLayoutParams();
        params.gravity = Gravity.CENTER_HORIZONTAL;
    } else {
        // Otherwise, add an empty view to the start as padding (but still scroll edge to edge).
        View leftPaddingView = LayoutInflater.from(getContext()).inflate(
                R.layout.widget_list_divider, widgetRow, false);
        leftPaddingView.getLayoutParams().width = Utilities.pxFromDp(
                16, getResources().getDisplayMetrics());
        widgetCells.addView(leftPaddingView, 0);
    }
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:36,代码来源:WidgetsBottomSheet.java

示例7: attachToContent

import android.view.ViewGroup; //导入方法依赖的package包/类
/**
 * Attaches the menu drawer to the content view.
 */
private static void attachToContent(Activity activity, MenuDrawer menuDrawer) {
    /**
     * Do not call mActivity#setContentView.
     * E.g. if using with a ListActivity, Activity#setContentView is overridden and dispatched to
     * MenuDrawer#setContentView, which then again would call Activity#setContentView.
     */
    ViewGroup content = (ViewGroup) activity.findViewById(android.R.id.content);
    content.removeAllViews();
    content.addView(menuDrawer, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:14,代码来源:MenuDrawer.java

示例8: attachToDecor

import android.view.ViewGroup; //导入方法依赖的package包/类
/**
 * Attaches the menu drawer to the window.
 */
private static void attachToDecor(Activity activity, MenuDrawer menuDrawer) {
    ViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();
    ViewGroup decorChild = (ViewGroup) decorView.getChildAt(0);

    decorView.removeAllViews();
    decorView.addView(menuDrawer, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);

    menuDrawer.mContentContainer.addView(decorChild, decorChild.getLayoutParams());
}
 
开发者ID:ultrasonic,项目名称:ultrasonic,代码行数:13,代码来源:MenuDrawer.java

示例9: instantiateItem

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public Object instantiateItem(ViewGroup container, int position) {
    // TODO Auto-generated method stub
    ViewGroup parent = (ViewGroup) viewList.get(position).getParent();
    if (parent != null) {
        parent.removeAllViews();
    }
    container.addView(viewList.get(position));
    return viewList.get(position);
}
 
开发者ID:monkeywiiu,项目名称:WiiuWeather,代码行数:11,代码来源:WeatherActivity.java

示例10: removeAllViews

import android.view.ViewGroup; //导入方法依赖的package包/类
/**
 * remove all views
 *
 * @param viewGroup
 */
public static void removeAllViews(ViewGroup viewGroup) {
    if (viewGroup != null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
            if (viewGroup.isInLayout()) {
                viewGroup.removeAllViewsInLayout();
            } else {
                viewGroup.removeAllViews();
            }
        } else {
            viewGroup.removeAllViews();
        }
    }
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:19,代码来源:LuaViewUtil.java

示例11: bind

import android.view.ViewGroup; //导入方法依赖的package包/类
private static void bind(ViewGroup viewGroup, ItemView itemView, List<?> viewModelList, final OnItemClickListener<?> onItemClickListener) {
    if (viewModelList != null && !viewModelList.isEmpty()) {
        viewGroup.removeAllViews();
        for (int pos=0; pos<viewModelList.size(); pos++) {
            final Object viewModel = viewModelList.get(pos);
            final ViewDataBinding binding = DataBindingUtil.inflate(LayoutInflater.from(viewGroup.getContext()),
                    itemView.layoutRes(), viewGroup, true);
            binding.setVariable(itemView.bindingVariable(), viewModel);

            setListener(onItemClickListener, ViewHolder.createViewHolder(viewGroup.getContext(), binding.getRoot()), viewModel, pos);
        }
    }
}
 
开发者ID:fashare2015,项目名称:MVVM-JueJin,代码行数:14,代码来源:ViewGroupAdapter.java

示例12: initView

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public void initView() {//必须调用

	//添加用户名片,这些方式都可<<<<<<<<<<<<<<<<<<<<<<
	//		//方式一
	//		bvlUser = (BaseViewLayout<User>) findViewById(R.id.bvlUser);
	//		bvlUser.createView(new UserView(context, getResources()));
	//
	//		//方式二
	//		uvlUser = (UserViewLayout) findViewById(R.id.uvlUser);

	//方式三
	llUserBusinessCardContainer = (ViewGroup) findViewById(R.id.llUserBusinessCardContainer);
	llUserBusinessCardContainer.removeAllViews();

	userView = new UserView(context, getResources());
	llUserBusinessCardContainer.addView(userView.createView(getLayoutInflater()));
	//添加用户名片,这些方式都可>>>>>>>>>>>>>>>>>>>>>>>


	llUserMoment = findViewById(R.id.llUserMoment);
	gvUserMoment = (GridView) findViewById(R.id.gvUserMoment);

	tvUserRemark = (TextView) findViewById(R.id.tvUserRemark);
	tvUserTag = (TextView) findViewById(R.id.tvUserTag);

	llUserMoment.setVisibility(isOnEditMode ? View.GONE : View.VISIBLE);
	if (isOnEditMode == false) {
		//添加底部菜单<<<<<<<<<<<<<<<<<<<<<<
		llUserBottomMenuContainer = (ViewGroup) findViewById(R.id.llUserBottomMenuContainer);
		llUserBottomMenuContainer.removeAllViews();

		bottomMenuView = new BottomMenuView(context, getResources(), REQUEST_TO_BOTTOM_MENU);
		llUserBottomMenuContainer.addView(bottomMenuView.createView(getLayoutInflater()));
		//添加底部菜单>>>>>>>>>>>>>>>>>>>>>>>
	}

}
 
开发者ID:TommyLemon,项目名称:APIJSON-Android-RxJava,代码行数:39,代码来源:UserActivity.java

示例13: setContentView

import android.view.ViewGroup; //导入方法依赖的package包/类
public void setContentView(int resId) {
    ensureSubDecor();
    ViewGroup contentParent = (ViewGroup) this.mSubDecor.findViewById(16908290);
    contentParent.removeAllViews();
    LayoutInflater.from(this.mContext).inflate(resId, contentParent);
    this.mOriginalWindowCallback.onContentChanged();
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:8,代码来源:AppCompatDelegateImplV7.java

示例14: destroyItem

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
    container.removeAllViews();
}
 
开发者ID:yangchaojiang,项目名称:ChatKeyboard-master,代码行数:5,代码来源:MediaPagerAdapter.java

示例15: gotoContactEdit

import android.view.ViewGroup; //导入方法依赖的package包/类
private void gotoContactEdit() {
    ViewGroup container = (ViewGroup) getView().findViewById(R.id.contacts_container);
    container.removeAllViews();
    container.addView(new ContactEditView(getContext()));
}
 
开发者ID:wongcain,项目名称:okuki,代码行数:6,代码来源:ContactsFragment.java


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