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