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


Java ViewStubCompat类代码示例

本文整理汇总了Java中android.support.v7.widget.ViewStubCompat的典型用法代码示例。如果您正苦于以下问题:Java ViewStubCompat类的具体用法?Java ViewStubCompat怎么用?Java ViewStubCompat使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: onCreateView

import android.support.v7.widget.ViewStubCompat; //导入依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);

    rootLayout = (LinearLayout) rootView.findViewById(R.id.root_layout);
    replaceLayout = (ViewStubCompat) rootView.findViewById(R.id.replace_layout);
    multiStateView = (MultiStateView) rootView.findViewById(R.id.multiStateView);
    if (inflateExtraView() != -1) {
        replaceLayout.setLayoutResource(inflateExtraView());
        replaceLayout.inflate();
    }
    swipeRefresh = (SwipeRefreshLayout) rootView.findViewById(R.id.swipeRefresh);
    swipeRefresh.setOnRefreshListener(onRefreshListener());

    multiStateView.setStateListener(onStateListener());
    return view;
}
 
开发者ID:harrylefit,项目名称:eazycore,代码行数:19,代码来源:BaseMainWithDataFragment.java

示例2: inflateLayout

import android.support.v7.widget.ViewStubCompat; //导入依赖的package包/类
public void inflateLayout(@LayoutRes int res, ViewStubCompat.OnInflateListener listener) {
    if (viewStub != null) {
        if (listener != null) {
            viewStub.setOnInflateListener(listener);
        }

        viewStub.setLayoutResource(res);
        viewStub.inflate();
    }
}
 
开发者ID:MimiReader,项目名称:mimi-reader,代码行数:11,代码来源:GalleryImageBase.java

示例3: addIndicator

import android.support.v7.widget.ViewStubCompat; //导入依赖的package包/类
private void addIndicator() {
    if (mIndicatorRes != -1) {
        ViewStubCompat viewStub = (ViewStubCompat) mIndicatorsContainer.findViewById(R.id.pageIndicator);
        viewStub.setLayoutResource(mIndicatorRes);
        viewStub.setOnInflateListener(new ViewStubCompat.OnInflateListener() {
            @Override
            public void onInflate(ViewStubCompat stub, View inflated) {
                setViewPagerToPageIndicator();
            }
        });
        View view = viewStub.inflate();
        view.setVisibility(mPageIndicatorVisibility ? View.VISIBLE : View.GONE);
    }
}
 
开发者ID:meness,项目名称:EasyIntro,代码行数:15,代码来源:EasyIntroCarouselFragment.java

示例4: getReplaceLayout

import android.support.v7.widget.ViewStubCompat; //导入依赖的package包/类
public ViewStubCompat getReplaceLayout() {
    return replaceLayout;
}
 
开发者ID:harrylefit,项目名称:eazycore,代码行数:4,代码来源:BaseMainWithDataFragment.java

示例5: onViewCreated

import android.support.v7.widget.ViewStubCompat; //导入依赖的package包/类
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    if (view == null || !defaultLayout || getArguments() == null) {
        return;
    }

    viewStub = (ViewStubCompat) view.findViewById(R.id.view_stub);
    progressBar = (ProgressBar) view.findViewById(R.id.progress_bar);

    final String protocol = MimiUtil.httpOrHttps(getActivity());
    final String baseUrl = getString(R.string.image_link);
    final String basePath = getString(R.string.full_image_path, boardName, tim, fileExt);
    imageUrl = protocol + baseUrl + basePath;

    downloadTask = new DownloadThread(getImageFileLocation(), imageUrl);
    downloadTask.setProgressListener(new DownloadThread.ProgressListener() {
        @Override
        public void onProgressUpdate(int progress) {
            progressBar.setProgress(progress);
        }

        @Override
        public void onComplete(final String filePath) {
            Log.i(LOG_TAG, "Finished downloading image: location=" + filePath);
            if (!TextUtils.isEmpty(filePath) && getActivity() != null) {

                if (progressBar != null) {
                    progressBar.setVisibility(View.GONE);
                }

                imageFile = new File(filePath);
                displayImage(imageFile, getUserVisibleHint());


            }
        }
    });
    downloadTask.setErrorListener(new DownloadThread.ErrorListener() {
        @Override
        public void onError() {
            Log.e(LOG_TAG, "Error downloading file");
        }
    });

    downloadTask.start();
}
 
开发者ID:MimiReader,项目名称:mimi-reader,代码行数:49,代码来源:GalleryImageBase.java

示例6: inflateIndicatorContainer

import android.support.v7.widget.ViewStubCompat; //导入依赖的package包/类
private void inflateIndicatorContainer(final View view) {
    final ViewStubCompat indicatorContainerStub = (ViewStubCompat) view.findViewById(R.id.indicatorContainer);

    // set gravity
    FrameLayout.LayoutParams params = (FrameLayout.LayoutParams) indicatorContainerStub.getLayoutParams();
    params.gravity = mIndicatorContainerGravity;
    indicatorContainerStub.setLayoutParams(params);

    indicatorContainerStub.setLayoutResource(mIndicatorContainer);
    indicatorContainerStub.setOnInflateListener(new ViewStubCompat.OnInflateListener() {
        @Override
        public void onInflate(ViewStubCompat stub, View inflated) {
            // there must be predefined ids
            if (inflated.findViewById(R.id.leftIndicator) == null) {
                throw new RuntimeException(getString(R.string.exception_left_indicator_id));
            } else if (inflated.findViewById(R.id.rightIndicator) == null) {
                throw new RuntimeException(getString(R.string.exception_right_indicator_id));
            } else if (inflated.findViewById(R.id.pageIndicator) == null) {
                throw new RuntimeException(getString(R.string.exception_page_indicator_id));
            }
            // check indicators instanceof
            else if (!(inflated.findViewById(R.id.leftIndicator) instanceof LeftToggleIndicator)) {
                throw new RuntimeException(getString(R.string.exception_previous_indicator_instanceof));
            } else if (!(inflated.findViewById(R.id.rightIndicator) instanceof RightToggleIndicator)) {
                throw new RuntimeException(getString(R.string.exception_next_indicator_instanceof));
            }

            mIndicatorsContainer = inflated;

            // must be initialized after inflating indicator container
            mRightIndicator = (RightToggleIndicator) mIndicatorsContainer.findViewById(R.id.rightIndicator);
            mLeftIndicator = (LeftToggleIndicator) mIndicatorsContainer.findViewById(R.id.leftIndicator);
            mRightIndicator.setListener(EasyIntroCarouselFragment.this);
            mRightIndicator.withDisabled(mRightIndicatorEnabled);
            mLeftIndicator.setListener(EasyIntroCarouselFragment.this);
            mLeftIndicator.withDisabled(mLeftIndicatorEnabled);

            addIndicator();
            updateToggleIndicators();
        }
    });
    indicatorContainerStub.inflate();
}
 
开发者ID:meness,项目名称:EasyIntro,代码行数:44,代码来源:EasyIntroCarouselFragment.java


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