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


Java ViewGroup.removeView方法代码示例

本文整理汇总了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;

}
 
开发者ID:q805699513,项目名称:PagerSlidingTabStrip,代码行数:17,代码来源:FourFragment.java

示例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;
}
 
开发者ID:fengdongfei,项目名称:CXJPadProject,代码行数:18,代码来源:AddOrderServiceFragment.java

示例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);
    }
}
 
开发者ID:monthlypub,项目名称:SmingZZick_App,代码行数:27,代码来源:StickerApplyAdapter.java

示例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;

}
 
开发者ID:FallenCrood,项目名称:Review-,代码行数:16,代码来源:SettingFragment.java

示例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);
  }
 
开发者ID:rtr-nettest,项目名称:open-rmbt,代码行数:10,代码来源:RMBTResultPagerAdapter.java

示例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());
}
 
开发者ID:A-Miracle,项目名称:QiangHongBao,代码行数:9,代码来源:BottomBarBadge.java

示例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;
}
 
开发者ID:universum-studios,项目名称:android_ui,代码行数:9,代码来源:RefreshListFragment.java

示例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);
}
 
开发者ID:csarron,项目名称:renderscript_examples,代码行数:12,代码来源:MainActivity.java

示例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);
        }
    }
}
 
开发者ID:jeasinlee,项目名称:AndroidBasicLibs,代码行数:10,代码来源:ViewUtils.java

示例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);
}
 
开发者ID:aabognah,项目名称:LoRaWAN-Smart-Parking,代码行数:35,代码来源:CordovaActivity.java

示例11: destroyItem

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override public void destroyItem(ViewGroup container, int position, Object object) {
  container.removeView((View) object);
}
 
开发者ID:madhu314,项目名称:react-native-tabbed-view-pager-android,代码行数:4,代码来源:ReactViewPager.java

示例12: destroyItem

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public void destroyItem(ViewGroup collection, int position, Object view) {
    collection.removeView((View) view);
}
 
开发者ID:SalmanTKhan,项目名称:MyAnimeViewer,代码行数:5,代码来源:FabFilterFragment.java

示例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);
    }
}
 
开发者ID:kevinwang5658,项目名称:backstack,代码行数:7,代码来源:LinearBackStack.java

示例14: destroyItem

import android.view.ViewGroup; //导入方法依赖的package包/类
@Override
public void destroyItem(@NonNull ViewGroup collection,
                        int position,
                        @NonNull Object view) {
    collection.removeView((View) view);
}
 
开发者ID:h4h13,项目名称:RetroMusicPlayer,代码行数:7,代码来源:NowPlayingScreenPreferenceDialog.java

示例15: destroyItem

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


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