當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。