本文整理汇总了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;
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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());
}
示例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);
}
示例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();
}
}
}
示例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);
}
}
}
示例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()));
//添加底部菜单>>>>>>>>>>>>>>>>>>>>>>>
}
}
示例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();
}
示例14: destroyItem
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeAllViews();
}
示例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()));
}