android.widget.FrameLayout#removeView ( )源码实例Demo

下面列出了android.widget.FrameLayout#removeView ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: ShizuruNotes   文件: CalendarView.java
/**
 * 设置周栏视图
 *
 * @param cls WeekBar.class
 */
public final void setWeekBar(Class<?> cls) {
    if (cls == null) {
        return;
    }
    if (mDelegate.getWeekBarClass().equals(cls)) {
        return;
    }
    mDelegate.setWeekBarClass(cls);
    FrameLayout frameContent = findViewById(R.id.frameContent);
    frameContent.removeView(mWeekBar);

    try {
        Constructor constructor = cls.getConstructor(Context.class);
        mWeekBar = (WeekBar) constructor.newInstance(getContext());
    } catch (Exception e) {
        e.printStackTrace();
    }
    frameContent.addView(mWeekBar, 2);
    mWeekBar.setup(mDelegate);
    mWeekBar.onWeekStartChange(mDelegate.getWeekStart());
    this.mMonthPager.mWeekBar = mWeekBar;
    mWeekBar.onDateSelected(mDelegate.mSelectedCalendar, mDelegate.getWeekStart(), false);
}
 
源代码2 项目: KrGallery   文件: CameraActivity.java
@Override
public void onFragmentDestroy() {
    super.onFragmentDestroy();
    NotificationCenter.getInstance().removeObserver(this, NotificationCenter.cameraInitied);
    if (!deviceHasGoodCamera || cameraView == null) {
        return;
    }
    if (cameraAnimationInProgress) {
        return;
    }
    if (cameraOpened) {
        closeCamera(true);
    }
    hideCamera(true);
    if (cameraView != null) {
        cameraView.destroy(true, null);
        FrameLayout frameLayout = (FrameLayout) fragmentView;
        frameLayout.removeView(cameraView);
        cameraView = null;
    }
    fragmentView = null;
    if (mBaseDialog != null)
        mBaseDialog.dismiss();
    mBaseDialog = null;
}
 
源代码3 项目: UltimateAndroid   文件: AnimatedRectActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(layoutResId());

    FrameLayout activityRoot = (FrameLayout) findViewById(android.R.id.content);
    View parent = activityRoot.getChildAt(0);

    // better way ?
    mAnimated = new AnimatedRectLayout(this);
    activityRoot.removeView(parent);
    activityRoot.addView(mAnimated, parent.getLayoutParams());
    mAnimated.addView(parent);

    mAnimationType = getIntent().getIntExtra("animation_type", AnimatedRectLayout.ANIMATION_RANDOM);
    mAnimated.setAnimationType(mAnimationType);

    ObjectAnimator animator = ObjectAnimator.ofFloat(mAnimated, ANIMATED_RECT_LAYOUT_FLOAT_PROPERTY, 1).setDuration(600);
    animator.start();
}
 
源代码4 项目: UltimateAndroid   文件: AnimatedDoorActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(layoutResId());

    FrameLayout activityRoot = (FrameLayout) findViewById(android.R.id.content);
    View parent = activityRoot.getChildAt(0);

    // better way ?
    mAnimated = new AnimatedDoorLayout(this);
    activityRoot.removeView(parent);
    activityRoot.addView(mAnimated, parent.getLayoutParams());
    mAnimated.addView(parent);

    mDoorType = getIntent().getIntExtra("door_type", AnimatedDoorLayout.HORIZONTAL_DOOR);
    mAnimated.setDoorType(mDoorType);

    ObjectAnimator animator = ObjectAnimator.ofFloat(mAnimated, ANIMATED_DOOR_LAYOUT_FLOAT_PROPERTY, 1).setDuration(600);
    animator.start();
}
 
源代码5 项目: UltimateAndroid   文件: AnimatedRectActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(layoutResId());

    FrameLayout activityRoot = (FrameLayout) findViewById(android.R.id.content);
    View parent = activityRoot.getChildAt(0);

    // better way ?
    mAnimated = new AnimatedRectLayout(this);
    activityRoot.removeView(parent);
    activityRoot.addView(mAnimated, parent.getLayoutParams());
    mAnimated.addView(parent);

    mAnimationType = getIntent().getIntExtra("animation_type", AnimatedRectLayout.ANIMATION_RANDOM);
    mAnimated.setAnimationType(mAnimationType);

    ObjectAnimator animator = ObjectAnimator.ofFloat(mAnimated, ANIMATED_RECT_LAYOUT_FLOAT_PROPERTY, 1).setDuration(600);
    animator.start();
}
 
源代码6 项目: UltimateAndroid   文件: AnimatedDoorActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(layoutResId());

    FrameLayout activityRoot = (FrameLayout) findViewById(android.R.id.content);
    View parent = activityRoot.getChildAt(0);

    // better way ?
    mAnimated = new AnimatedDoorLayout(this);
    activityRoot.removeView(parent);
    activityRoot.addView(mAnimated, parent.getLayoutParams());
    mAnimated.addView(parent);

    mDoorType = getIntent().getIntExtra("door_type", AnimatedDoorLayout.HORIZONTAL_DOOR);
    mAnimated.setDoorType(mDoorType);

    ObjectAnimator animator = ObjectAnimator.ofFloat(mAnimated, ANIMATED_DOOR_LAYOUT_FLOAT_PROPERTY, 1).setDuration(600);
    animator.start();
}
 
@Override
public void onDestroyContentVideoView() {
    mActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
    decor.removeView(mView);
    mView = null;
}
 
源代码8 项目: fvip   文件: WebVideoActivity.java
/** 隐藏视频全屏 */
private void hideCustomView() {
    if (customView == null) {
        return;
    }

    setStatusBarVisibility(true);
    FrameLayout decor = (FrameLayout) getWindow().getDecorView();
    decor.removeView(fullscreenContainer);
    fullscreenContainer = null;
    customView = null;
    customViewCallback.onCustomViewHidden();
    webView.setVisibility(View.VISIBLE);
}
 
源代码9 项目: android-chromium   文件: Shell.java
/**
 * Set the SurfaceView being renderered to as soon as it is available.
 */
public void setContentViewRenderView(ContentViewRenderView contentViewRenderView) {
    FrameLayout contentViewHolder = (FrameLayout) findViewById(R.id.contentview_holder);
    if (contentViewRenderView == null) {
        if (mContentViewRenderView != null) {
            contentViewHolder.removeView(mContentViewRenderView);
        }
    } else {
        contentViewHolder.addView(contentViewRenderView,
                new FrameLayout.LayoutParams(
                        FrameLayout.LayoutParams.MATCH_PARENT,
                        FrameLayout.LayoutParams.MATCH_PARENT));
    }
    mContentViewRenderView = contentViewRenderView;
}
 
@Override
public void exitFullscreenVideo() {
    FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
    decor.removeView(mView);
    setSystemUiVisibility(false);
    mView = null;
}
 
源代码11 项目: YCVideoPlayer   文件: VideoTextureView.java
/**
 * 添加TextureView到视图中
 * @param frameLayout               布局
 * @param textureView               textureView
 */
public void addTextureView(FrameLayout frameLayout , VideoTextureView textureView){
    frameLayout.removeView(textureView);
    FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(
            ViewGroup.LayoutParams.MATCH_PARENT,
            ViewGroup.LayoutParams.MATCH_PARENT, Gravity.CENTER);
    frameLayout.addView(textureView, 0, params);
}
 
@Override
public void onDestroyContentVideoView() {
    mActivity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
    FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
    decor.removeView(mView);
    mView = null;
}
 
/***
 * 设置内容布局
 *
 * @param layoutId layout id
 */
private void setCustomContentView(FrameLayout view_container, int layoutId) {
    View localView = View.inflate(getActivity(), layoutId, null);
    if (localView != null) {
        if (this.mDecoratedView != null) {
            view_container.removeView(mDecoratedView);
        }
        view_container.addView(localView);
        localView.setId(layoutId);
        mDecoratedView = localView;
    }
}
 
/***
 * 设置内容布局
 *
 * @param layoutId layout id
 */
private void setCustomContentView(FrameLayout view_container, int layoutId) {
    View localView = View.inflate(getActivity(), layoutId, null);
    if (localView != null) {
        if (this.mDecoratedView != null) {
            view_container.removeView(mDecoratedView);
        }
        view_container.addView(localView);
        localView.setId(layoutId);
        mDecoratedView = localView;
    }
}
 
/**
 * Sets the Empty View to be used by the Adapter View.
 * <p/>
 * We need it handle it ourselves so that we can Pull-to-Refresh when the
 * Empty View is shown.
 * <p/>
 * Please note, you do <strong>not</strong> usually need to call this
 * method yourself. Calling setEmptyView on the AdapterView will
 * automatically call this method and set everything up. This includes
 * when the Android Framework automatically sets the Empty View based on
 * it's ID.
 * 
 * @param newEmptyView - Empty View to be used
 */
public final void setEmptyView(View newEmptyView) {
    FrameLayout refreshableViewWrapper = getRefreshableViewWrapper();

    // If we already have an Empty View, remove it
    if (null != mEmptyView) {
        refreshableViewWrapper.removeView(mEmptyView);
    }

    if (null != newEmptyView) {
        // New view needs to be clickable so that Android recognizes it as
        // a
        // target for Touch Events
        newEmptyView.setClickable(true);

        ViewParent newEmptyViewParent = newEmptyView.getParent();
        if (null != newEmptyViewParent && newEmptyViewParent instanceof ViewGroup) {
            ((ViewGroup) newEmptyViewParent).removeView(newEmptyView);
        }

        refreshableViewWrapper.addView(newEmptyView, ViewGroup.LayoutParams.MATCH_PARENT,
                ViewGroup.LayoutParams.MATCH_PARENT);
    }

    if (mRefreshableView instanceof EmptyViewMethodAccessor) {
        ((EmptyViewMethodAccessor) mRefreshableView).setEmptyViewInternal(newEmptyView);
    } else {
        mRefreshableView.setEmptyView(newEmptyView);
    }
    mEmptyView = newEmptyView;
}
 
源代码16 项目: OverlayMenu   文件: OverMenuView.java
private void removeMenuOverlay() {
    if (DEBUG) {
        Log.i(TAG, "removeMenuOverlay");
    }
    FrameLayout root = (FrameLayout) ((Activity) getContext()).getWindow().getDecorView();
    View view = root.findViewById(R.id.OverMenuId);
    if (null != view) {
        root.removeView(view);
    }
    mMenuShown = false;
}
 
@Override
protected Object instantiateItem(ViewGroup viewGroup, int row, int col) {
    View view = null;

    if(col == 0) {
        view = View.inflate(mContext, R.layout.image_viewer, null);
        ImageView imageView = (ImageView) view.findViewById(R.id.imageView);
        TextView statusText = (TextView) view.findViewById(R.id.textViewStatus);
        if (Logger.DEBUG) imageView.setOnClickListener(ImageViewerActivity.this);
        imageView.setOnLongClickListener(ImageViewerActivity.this);

        File file = null;
        if (mCount > 0) {
            file = mFileList.get(mCount - (row + 1));
        }
        statusText.setText(String.format("%d/%d", row + 1, mCount));
        if (mFirstImage != null && row == mFirstIndex) {
            imageView.setImageBitmap(mFirstImage);
        } else {
            if (file != null) {
                Bitmap thumb = ThumbCache.getThumbFromMemCache(file);
                if (thumb != null) {
                    imageView.setImageBitmap(thumb);
                    Logger.debug(TAG, "Got thumb %s from memcache.", file);
                } else {
                    new LoadThumbTask(imageView, file).execute();
                }
            } else {
                TextView textView = new TextView(mContext);
                textView.setText(R.string.label_no_images);
                textView.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL);
                FrameLayout frame = ((FrameLayout) view);
                frame.addView(textView);
                frame.removeView(imageView);
            }
        }

        if (file != null) {
            ImageView imageViewVideo = (ImageView) view.findViewById(R.id.imageViewVideo);
            String fname = file.getName().toUpperCase();
            if (fname.endsWith("MP4")) {
                imageViewVideo.setImageResource(R.drawable.detail_mode_icon_video);
            } else if (fname.endsWith("JPG")) {
                imageViewVideo.setImageResource(R.drawable.detail_mode_icon_photo);
            } else {
                imageViewVideo.setImageResource(R.drawable.detail_mode_icon_burst);
            }
        }
        viewGroup.addView(view);
    }
    if(Logger.DEBUG) Logger.debug(TAG, "View created: %d/%d", row, col);
    return view;
}
 
源代码18 项目: Dota2Helper   文件: PluginManager.java
public void removePlugin(PluginOverlay plugin, FrameLayout stub) {
	stub.removeView(plugin);
}
 
源代码19 项目: SimplifyReader   文件: PluginManager.java
public void removePlugin(PluginOverlay plugin, FrameLayout stub) {
	stub.removeView(plugin);
}
 
源代码20 项目: 365browser   文件: VrShellDelegate.java
private void removeVrViews() {
    mActivity.onExitVr();
    FrameLayout decor = (FrameLayout) mActivity.getWindow().getDecorView();
    decor.removeView(mVrShell.getContainer());
}