當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。