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


Java ViewGroup.removeViewInLayout方法代码示例

本文整理汇总了Java中android.view.ViewGroup.removeViewInLayout方法的典型用法代码示例。如果您正苦于以下问题:Java ViewGroup.removeViewInLayout方法的具体用法?Java ViewGroup.removeViewInLayout怎么用?Java ViewGroup.removeViewInLayout使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.ViewGroup的用法示例。


在下文中一共展示了ViewGroup.removeViewInLayout方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: removeView

import android.view.ViewGroup; //导入方法依赖的package包/类
/**
 * remove a view
 *
 * @param parent
 * @param view
 */
public static void removeView(ViewGroup parent, View view) {
    //这里不使用post来做,这样代码更可控,而是改为将refresh下拉动作延后一帧处理,见@link
    //这里调用removeViewInLayout方法,可以在onLayout的时候调用,否则会产生问题
    if (parent != null && view != null) {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
            if (parent.isInLayout()) {
                parent.removeViewInLayout(view);
            } else {
                parent.removeView(view);
            }
        } else {
            parent.removeView(view);
        }
    }
}
 
开发者ID:alibaba,项目名称:LuaViewPlayground,代码行数:22,代码来源:LuaViewUtil.java

示例2: mockStartWithPopAnim

import android.view.ViewGroup; //导入方法依赖的package包/类
private void mockStartWithPopAnim(ISupportFragment from, ISupportFragment to, final Animation exitAnim) {
    Fragment fromF = (Fragment) from;
    final ViewGroup container = findContainerById(fromF, from.getSupportDelegate().mContainerId);
    if (container == null) return;

    from.getSupportDelegate().mLockAnim = true;
    View fromView = fromF.getView();
    container.removeViewInLayout(fromView);

    final ViewGroup mock = addMockView(fromView, container);

    to.getSupportDelegate().mEnterAnimListener = new SupportFragmentDelegate.EnterAnimListener() {
        @Override
        public void onEnterAnimStart() {
            mock.startAnimation(exitAnim);

            mHandler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    container.removeView(mock);
                }
            }, exitAnim.getDuration() + BUFFER_TIME);
        }
    };
}
 
开发者ID:wzx54321,项目名称:XinFramework,代码行数:26,代码来源:TransactionDelegate.java

示例3: inflate

import android.view.ViewGroup; //导入方法依赖的package包/类
public View inflate() {
    ViewParent viewParent = getParent();
    if (viewParent == null || !(viewParent instanceof ViewGroup)) {
        throw new IllegalStateException("ViewStub must have a non-null ViewGroup viewParent");
    } else if (this.mLayoutResource != 0) {
        LayoutInflater factory;
        ViewGroup parent = (ViewGroup) viewParent;
        if (this.mInflater != null) {
            factory = this.mInflater;
        } else {
            factory = LayoutInflater.from(getContext());
        }
        View view = factory.inflate(this.mLayoutResource, parent, false);
        if (this.mInflatedId != -1) {
            view.setId(this.mInflatedId);
        }
        int index = parent.indexOfChild(this);
        parent.removeViewInLayout(this);
        LayoutParams layoutParams = getLayoutParams();
        if (layoutParams != null) {
            parent.addView(view, index, layoutParams);
        } else {
            parent.addView(view, index);
        }
        this.mInflatedViewRef = new WeakReference(view);
        if (this.mInflateListener != null) {
            this.mInflateListener.onInflate(this, view);
        }
        return view;
    } else {
        throw new IllegalArgumentException("ViewStub must have a valid layoutResource");
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:34,代码来源:ViewStubCompat.java


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