本文整理汇总了Java中android.view.ViewGroup.removeView方法的典型用法代码示例。如果您正苦于以下问题:Java ViewGroup.removeView方法的具体用法?Java ViewGroup.removeView怎么用?Java ViewGroup.removeView使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.ViewGroup
的用法示例。
在下文中一共展示了ViewGroup.removeView方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onCreateView
import android.view.ViewGroup; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
if (view == null) {
view = inflater.inflate(R.layout.fragment_view, container, false);
//在这里做一些初始化处理
TextView textView = (TextView) view.findViewById(R.id.tv_content);
textView.setText("第四个");
} else {
ViewGroup viewGroup = (ViewGroup) view.getParent();
if (viewGroup != null)
viewGroup.removeView(view);
}
return view;
}
示例2: initRootView
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override //Outsourcing
protected View initRootView(LayoutInflater inflater) {
if (view == null) {
view = View.inflate(getActivity(), R.layout.fragment_add_order_service, null);
}
ButterKnife.bind(this, view);
ViewGroup myparent = (ViewGroup) view.getParent();
//获取args传递的参数
if (getArguments() != null) {
argsModel = (OrderModel) getArguments().getSerializable("args");
Log.d(TAG, "initRootView: " + argsModel.assessScore);
}
if (myparent != null) {
myparent.removeView(view);
}
return view;
}
示例3: deleteSticker
import android.view.ViewGroup; //导入方法依赖的package包/类
public void deleteSticker(long attachId) {
if (stickers == null) {
return;
}
Stickerable stickerableToDelete = null;
for (Stickerable stickerable : stickers) {
if (attachId == stickerable.getAttachId()) {
stickerableToDelete = stickerable;
break;
}
}
if (stickerableToDelete == null) {
return;
}
stickers.remove(stickerableToDelete);
ViewGroup parent = (ViewGroup) ((View) stickerableToDelete).getParent();
parent.removeView((View) stickerableToDelete);
notifyDataSetChanged();
if (onStickerApplyEventListener != null) {
onStickerApplyEventListener.onStickerRemove(stickerableToDelete);
}
}
示例4: onCreateView
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (mRootView == null) {
mRootView = inflater.inflate(R.layout.fragment_setting, container, false);
creatViews();
}
//缓存的mRootView需要判断是否已经被加过parent, 如果有parent需要从parent删除,要不然会发生这个mRootView已经有parent的错误。
ViewGroup parent = (ViewGroup) mRootView.getParent();
if (parent != null) {
parent.removeView(mRootView);
}
return mRootView;
}
示例5: destroyItem
import android.view.ViewGroup; //导入方法依赖的package包/类
/**
*
*/
@Override
public void destroyItem(final ViewGroup vg, final int i, final Object obj)
{
final View view = (View) obj;
vg.removeView(view);
}
示例6: removeFromTab
import android.view.ViewGroup; //导入方法依赖的package包/类
void removeFromTab(BottomBarTab tab) {
FrameLayout badgeAndTabContainer = (FrameLayout) getParent();
ViewGroup originalTabContainer = (ViewGroup) badgeAndTabContainer.getParent();
badgeAndTabContainer.removeView(tab);
originalTabContainer.removeView(badgeAndTabContainer);
originalTabContainer.addView(tab, tab.getIndexInTabContainer());
}
示例7: onCreateView
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
@SuppressWarnings("ConstantConditions")
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
final ViewGroup view = (ViewGroup) super.onCreateView(inflater, container, savedInstanceState);
view.removeView(view.findViewById(android.R.id.list));
view.addView(mListView = (ListViewWidget) inflater.inflate(R.layout.list_view_swipe_to_refresh, container, false));
return view;
}
示例8: replaceView
import android.view.ViewGroup; //导入方法依赖的package包/类
void replaceView(View originalView, View newView) {
originalView.setTag(newView);
newView.setLayoutParams(new FrameLayout.LayoutParams(originalView.getLayoutParams()));
ViewGroup parent = (ViewGroup) originalView.getParent();
int index = parent.indexOfChild(originalView);
parent.removeView(originalView);
parent.addView(newView, index);
}
示例9: removeSelfFromParent
import android.view.ViewGroup; //导入方法依赖的package包/类
public static void removeSelfFromParent(View view) {
if (view != null) {
ViewParent parent = view.getParent();
if (parent != null && parent instanceof ViewGroup) {
ViewGroup group = (ViewGroup) parent;
group.removeView(view);
}
}
}
示例10: createViews
import android.view.ViewGroup; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
protected void createViews() {
// This builds the view. We could probably get away with NOT having a LinearLayout, but I like having a bucket!
LOG.d(TAG, "CordovaActivity.createViews()");
Display display = getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();
root = new LinearLayoutSoftKeyboardDetect(this, width, height);
root.setOrientation(LinearLayout.VERTICAL);
root.setLayoutParams(new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT, 0.0F));
appView.setId(100);
appView.setLayoutParams(new LinearLayout.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
ViewGroup.LayoutParams.MATCH_PARENT,
1.0F));
// need to remove appView from any existing parent before invoking root.addView(appView)
ViewParent parent = appView.getParent();
if ((parent != null) && (parent != root)) {
LOG.d(TAG, "removing appView from existing parent");
ViewGroup parentGroup = (ViewGroup) parent;
parentGroup.removeView(appView);
}
root.addView((View) appView);
setContentView(root);
int backgroundColor = preferences.getInteger("BackgroundColor", Color.BLACK);
root.setBackgroundColor(backgroundColor);
}
示例11: destroyItem
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}
示例12: destroyItem
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public void destroyItem(ViewGroup collection, int position, Object view) {
collection.removeView((View) view);
}
示例13: removeView
import android.view.ViewGroup; //导入方法依赖的package包/类
private void removeView(BackStackNode backStackNode, ViewGroup viewGroup){
if (!backStackNode.shouldRetain){
ViewGroup parent = (ViewGroup) viewGroup.getParent();
parent.removeView(viewGroup);
}
}
示例14: destroyItem
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public void destroyItem(@NonNull ViewGroup collection,
int position,
@NonNull Object view) {
collection.removeView((View) view);
}
示例15: destroyItem
import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public void destroyItem(ViewGroup container, int position, Object object) {
container.removeView((View) object);
}