Java Code Examples for android.widget.FrameLayout#removeViewAt()

The following examples show how to use android.widget.FrameLayout#removeViewAt() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PictureAdapter.java    From v9porn with MIT License 6 votes vote down vote up
@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
    FrameLayout view = (FrameLayout) object;
    for (int i = 0; i < view.getChildCount(); i++) {
        View childView = view.getChildAt(i);
        if (childView instanceof PhotoView) {
            childView.setOnClickListener(null);
            childView.setOnLongClickListener(null);
            GlideApp.with(container).clear(childView);
            view.removeViewAt(i);
            Logger.t(TAG).d("clean photoView");
        }
    }
    container.removeView(view);
    Logger.t(TAG).d("destroyItem");
}
 
Example 2
Source File: PictureAdapter.java    From v9porn with MIT License 6 votes vote down vote up
@Override
public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
    FrameLayout view = (FrameLayout) object;
    for (int i = 0; i < view.getChildCount(); i++) {
        View childView = view.getChildAt(i);
        if (childView instanceof PhotoView) {
            childView.setOnClickListener(null);
            childView.setOnLongClickListener(null);
            GlideApp.with(container).clear(childView);
            view.removeViewAt(i);
            Logger.t(TAG).d("clean photoView");
        }
    }
    container.removeView(view);
    Logger.t(TAG).d("destroyItem");
}
 
Example 3
Source File: RecyclerViewFragment.java    From visual-goodies with Apache License 2.0 6 votes vote down vote up
/**
 * Sets a view to be displayed when the list is empty with optional LayoutParams.
 * @param view Displayed when the list is empty.
 * @param params Information about how view's layout in the countainer.
 */
public void setEmptyView(View view, FrameLayout.LayoutParams params){
    emptyView = view;
    isEmptyViewEmptyText = true;
    FrameLayout frameLayout = (FrameLayout) getView();
    if (frameLayout == null)
        return;
    //In order to avoid having more than one emptyViews added to the layout
    if (frameLayout.getChildCount() > 2)
        frameLayout.removeViewAt(2);
    if (this.emptyText != null)
        frameLayout.findViewById(android.R.id.text1).setVisibility(View.GONE);
    if (params == null) {
        params = new FrameLayout.LayoutParams(
                ViewGroup.LayoutParams.WRAP_CONTENT,
                ViewGroup.LayoutParams.WRAP_CONTENT);
        params.gravity = Gravity.CENTER;
    }

    frameLayout.addView(view, 1, params);
    this.emptyViewAddedToLayout = true;
    actuallySetEmptyView();
}
 
Example 4
Source File: WebViewActivity.java    From YCAudioPlayer with Apache License 2.0 5 votes vote down vote up
private void showErrorPage() {
    FrameLayout webParentView = (FrameLayout) mWebView.getParent();
    initErrorPage();//初始化自定义页面
    while (webParentView.getChildCount() > 1) {
        webParentView.removeViewAt(0);
    }
    @SuppressWarnings("deprecation")
    FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(
            FrameLayout.LayoutParams.FILL_PARENT, FrameLayout.LayoutParams.FILL_PARENT);
    webParentView.addView(mErrorView, 0, lp);
    mIsErrorPage = true;
}