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


Java ViewStub.setLayoutResource方法代码示例

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


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

示例1: findViewFromViewStub

import android.view.ViewStub; //导入方法依赖的package包/类
/**
 * @param parentView
 * @param viewStubId
 * @param inflatedViewId
 * @param inflateLayoutResId
 * @return
 */
public static View findViewFromViewStub(View parentView, int viewStubId, int inflatedViewId, int inflateLayoutResId) {
    if (null == parentView) {
        return null;
    }
    View view = parentView.findViewById(inflatedViewId);
    if (null == view) {
        ViewStub vs = (ViewStub) parentView.findViewById(viewStubId);
        if (null == vs) {
            return null;
        }
        if (vs.getLayoutResource() < 1 && inflateLayoutResId > 0) {
            vs.setLayoutResource(inflateLayoutResId);
        }
        view = vs.inflate();
        if (null != view) {
            view = view.findViewById(inflatedViewId);
        }
    }
    return view;
}
 
开发者ID:coopese,项目名称:qmui,代码行数:28,代码来源:QMUIViewHelper.java

示例2: initViews

import android.view.ViewStub; //导入方法依赖的package包/类
protected void initViews() {
    inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.ultimate_recycler_view_layout, this);
    mRecyclerView = (RecyclerView) view.findViewById(R.id.ultimate_list);
    mSwipeRefreshLayout = (VerticalSwipeRefreshLayout) view.findViewById(R.id.swipe_refresh_layout);
    setScrollbars();
    mSwipeRefreshLayout.setEnabled(false);

    if (mRecyclerView != null) {
        mRecyclerView.setClipToPadding(mClipToPadding);
        if (mPadding != -1.1f) {
            mRecyclerView.setPadding(mPadding, mPadding, mPadding, mPadding);
        } else {
            mRecyclerView.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom);
        }
    }

    defaultFloatingActionButton = (FloatingActionButton) view.findViewById(R.id.defaultFloatingActionButton);
    setDefaultScrollListener();

    /**
     * empty view setup
     */
    mEmpty = (ViewStub) view.findViewById(R.id.emptyview);
    if (mEmptyId != 0) {
        mEmpty.setLayoutResource(mEmptyId);
        mEmptyView = mEmpty.inflate();
        mEmpty.setVisibility(View.GONE);
    }

    /**
     * floating button setup
     */
    mFloatingButtonViewStub = (ViewStub) view.findViewById(R.id.floatingActionViewStub);
    mFloatingButtonViewStub.setLayoutResource(mFloatingButtonId);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:37,代码来源:UltimateRecyclerView.java

示例3: initViews

import android.view.ViewStub; //导入方法依赖的package包/类
@Override
protected void initViews() {
    //super.initViews();
    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.custom_recycler_view_layout, this);
    mRecyclerView = (RecyclerView) view.findViewById(R.id.ultimate_list);
    mSwipeRefreshLayout = null;

    if (mRecyclerView != null) {

        mRecyclerView.setClipToPadding(mClipToPadding);
        if (mPadding != -1.1f) {
            mRecyclerView.setPadding(mPadding, mPadding, mPadding, mPadding);
        } else {
            mRecyclerView.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom);
        }
    }

    defaultFloatingActionButton = (FloatingActionButton) view.findViewById(R.id.defaultFloatingActionButton);
    setDefaultScrollListener();

    mEmpty = (ViewStub) view.findViewById(R.id.emptyview);
    mFloatingButtonViewStub = (ViewStub) view.findViewById(R.id.floatingActionViewStub);

    mEmpty.setLayoutResource(mEmptyId);

    mFloatingButtonViewStub.setLayoutResource(mFloatingButtonId);

    if (mEmptyId != 0)
        mEmptyView = mEmpty.inflate();
    mEmpty.setVisibility(View.GONE);

    if (mFloatingButtonId != 0) {
        mFloatingButtonView = mFloatingButtonViewStub.inflate();
        mFloatingButtonView.setVisibility(View.VISIBLE);
    }

}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:39,代码来源:CustomUltimateRecyclerview.java

示例4: onCreateView

import android.view.ViewStub; //导入方法依赖的package包/类
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_page, container, false);

    ViewStub sampleStub = (ViewStub) view.findViewById(R.id.sampleStub);
    sampleStub.setLayoutResource(sampleLayoutRes);
    sampleStub.inflate();

    ViewStub practiceStub = (ViewStub) view.findViewById(R.id.practiceStub);
    practiceStub.setLayoutResource(practiceLayoutRes);
    practiceStub.inflate();

    return view;
}
 
开发者ID:songjiabin,项目名称:MySelfDemo,代码行数:16,代码来源:PageFragment.java

示例5: onCreate

import android.view.ViewStub; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    String html = this.getIntent().getStringExtra("html");
    lessonName = this.getIntent().getStringExtra("lesson_name");
    getSupportActionBar().setDisplayHomeAsUpEnabled(true);
    getSupportActionBar().setDisplayShowHomeEnabled(true);
    getSupportActionBar().setTitle(lessonName);

    toolbar.setNavigationOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {
            finish();
        }
    });

    ViewStub stub = (ViewStub) findViewById(R.id.layout_stub);
    stub.setLayoutResource(R.layout.activity_web_view);
    View inflated = stub.inflate();

    String mime = "text/html";
    String encoding = "utf-8";

    final WebView myWebView = (WebView) findViewById(R.id.webViewArcticle);

    myWebView.getSettings().setJavaScriptEnabled(true);
    myWebView.setWebViewClient(webViewClient);
    myWebView.loadDataWithBaseURL(null, html, mime, encoding, null);
}
 
开发者ID:white-collar,项目名称:mobile-grammar,代码行数:34,代码来源:WebViewActivity.java

示例6: LinkShareViewHolder

import android.view.ViewStub; //导入方法依赖的package包/类
public LinkShareViewHolder(View itemView) {
                super(itemView);
                ViewStub viewStub = (ViewStub) itemView.findViewById(R.id.vs_share_fragment_item_main);
                viewStub.setLayoutResource(R.layout.share_fragment_item_link_layout);
                viewStub.inflate();
//                display = (LinearLayout) viewStub.inflate().findViewById(R.id.ll_share_fragment_item_container);
        }
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:8,代码来源:LinkShareViewHolder.java

示例7: initHeadView

import android.view.ViewStub; //导入方法依赖的package包/类
private void initHeadView() {
    int headLayoutId = bindHeadLayoutId();
    appBar = (AppBarLayout) findViewById(R.id.app_bar);
    ViewStub headViewStub = (ViewStub) findViewById(R.id.base_state_head);
    if (headLayoutId != 0 && headViewStub != null) {
        appBar.setVisibility(View.VISIBLE);
        headViewStub.setLayoutResource(headLayoutId);
        headViewStub.inflate();
    }
}
 
开发者ID:zengcanxiang,项目名称:MVP-Practice-Project-Template,代码行数:11,代码来源:StateActivity.java

示例8: showBody

import android.view.ViewStub; //导入方法依赖的package包/类
protected void showBody() {
    ViewStub bodyViewStub = (ViewStub) findViewById(R.id.base_state_body);
    //如果这个布局已经被渲染出来,那么就会为空
    if (bodyViewStub != null) {
        bodyViewStub.setLayoutResource(bodyLayoutId);
        bodyViewStub.inflate();
        bodyLayoutId = 0;
    }
    initViews();
    setViewsListener();
}
 
开发者ID:zengcanxiang,项目名称:MVP-Practice-Project-Template,代码行数:12,代码来源:StateFragment.java

示例9: initHeadView

import android.view.ViewStub; //导入方法依赖的package包/类
private void initHeadView() {
    appBar = (AppBarLayout) findViewById(R.id.app_bar);
    int headLayoutId = bindHeadLayoutId();
    ViewStub headViewStub = (ViewStub) findViewById(R.id.base_state_head);
    if (headLayoutId != 0 && headViewStub != null) {
        appBar.setVisibility(View.VISIBLE);
        headViewStub.setLayoutResource(headLayoutId);
        headViewStub.inflate();
    }
}
 
开发者ID:zengcanxiang,项目名称:MVP-Practice-Project-Template,代码行数:11,代码来源:DataListActivity.java

示例10: initViews

import android.view.ViewStub; //导入方法依赖的package包/类
@Override
protected void initViews() {
    LayoutInflater inflater = (LayoutInflater) getContext().getSystemService(Context.LAYOUT_INFLATER_SERVICE);
    View view = inflater.inflate(R.layout.swipeable_ultimate_recycler_view_layout, this);
    mRecyclerView = (SwipeListView) view.findViewById(R.id.ultimate_list);

    mSwipeRefreshLayout = (VerticalSwipeRefreshLayout) view.findViewById(R.id.swipe_refresh_layout);
    setScrollbars();
    mSwipeRefreshLayout.setEnabled(false);

    if (mRecyclerView != null) {

        mRecyclerView.setClipToPadding(mClipToPadding);
        if (mPadding != -1.1f) {
            mRecyclerView.setPadding(mPadding, mPadding, mPadding, mPadding);
        } else {
            mRecyclerView.setPadding(mPaddingLeft, mPaddingTop, mPaddingRight, mPaddingBottom);
        }
    }

    defaultFloatingActionButton = (FloatingActionButton) view.findViewById(R.id.defaultFloatingActionButton);
    setDefaultScrollListener();

    mEmpty = (ViewStub) view.findViewById(R.id.emptyview);
    mFloatingButtonViewStub = (ViewStub) view.findViewById(R.id.floatingActionViewStub);

    mEmpty.setLayoutResource(mEmptyId);

    mFloatingButtonViewStub.setLayoutResource(mFloatingButtonId);

    if (mEmptyId != 0)
        mEmptyView = mEmpty.inflate();
    mEmpty.setVisibility(View.GONE);

    if (mFloatingButtonId != 0) {
        mFloatingButtonView = mFloatingButtonViewStub.inflate();
        mFloatingButtonView.setVisibility(View.VISIBLE);
    }


}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:42,代码来源:SwipeableUltimateRecyclerview.java

示例11: errorView

import android.view.ViewStub; //导入方法依赖的package包/类
/**
 * 自定义加载错误布局
 */
public Builder errorView(@LayoutRes int errorViewId) {
    errorVs = new ViewStub(context);
    errorVs.setLayoutResource(errorViewId);
    return this;
}
 
开发者ID:yangchong211,项目名称:YCStateLayout,代码行数:9,代码来源:StateLayoutManager.java

示例12: errorView

import android.view.ViewStub; //导入方法依赖的package包/类
public Builder errorView(@LayoutRes int errorViewId) {
    errorVs = new ViewStub(context);
    errorVs.setLayoutResource(errorViewId);
    return this;
}
 
开发者ID:rawray,项目名称:RRFramework-Android,代码行数:6,代码来源:StatusLayoutManager.java

示例13: emptyDataView

import android.view.ViewStub; //导入方法依赖的package包/类
public Builder emptyDataView(@LayoutRes int noDataViewId) {
    emptyDataVs = new ViewStub(context);
    emptyDataVs.setLayoutResource(noDataViewId);
    return this;
}
 
开发者ID:rawray,项目名称:RRFramework-Android,代码行数:6,代码来源:StatusLayoutManager.java

示例14: VideoShareViewHolder

import android.view.ViewStub; //导入方法依赖的package包/类
public VideoShareViewHolder(View itemView) {
        super(itemView);
        ViewStub viewStub = (ViewStub) itemView.findViewById(R.id.vs_share_fragment_item_main);
        viewStub.setLayoutResource(R.layout.share_fragment_item_image_layout);
        display = (ListImageView) viewStub.inflate().findViewById(R.id.liv_share_fragment_item_main_image_display);
}
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:7,代码来源:VideoShareViewHolder.java

示例15: ImageShareViewHolder

import android.view.ViewStub; //导入方法依赖的package包/类
public  ImageShareViewHolder(View itemView) {
        super(itemView);
        ViewStub viewStub = (ViewStub) itemView.findViewById(R.id.vs_share_fragment_item_main);
        viewStub.setLayoutResource(R.layout.share_fragment_item_image_layout);
        display = (ListImageView) viewStub.inflate().findViewById(R.id.liv_share_fragment_item_main_image_display);
}
 
开发者ID:HelloChenJinJun,项目名称:TestChat,代码行数:7,代码来源:ImageShareViewHolder.java


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