當前位置: 首頁>>代碼示例>>Java>>正文


Java ViewStub.inflate方法代碼示例

本文整理匯總了Java中android.view.ViewStub.inflate方法的典型用法代碼示例。如果您正苦於以下問題:Java ViewStub.inflate方法的具體用法?Java ViewStub.inflate怎麽用?Java ViewStub.inflate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在android.view.ViewStub的用法示例。


在下文中一共展示了ViewStub.inflate方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: setProgressBarShown

import android.view.ViewStub; //導入方法依賴的package包/類
/**
 * Sets whether the progress bar below the header text is shown or not. The progress bar is
 * a lazily inflated ViewStub, which means the progress bar will not actually be part of the
 * view hierarchy until the first time this is set to {@code true}.
 */
public void setProgressBarShown(boolean shown) {
    final View progressBar = findManagedViewById(R.id.suw_layout_progress);
    if (progressBar != null) {
        progressBar.setVisibility(shown ? View.VISIBLE : View.GONE);
    } else if (shown) {
        final ViewStub progressBarStub =
                (ViewStub) findManagedViewById(R.id.suw_layout_progress_stub);
        if (progressBarStub != null) {
            progressBarStub.inflate();
        }
        if (mProgressBarColor != null) {
            setProgressBarColor(mProgressBarColor);
        }
    }
}
 
開發者ID:Trumeet,項目名稱:SetupWizardLibCompat,代碼行數:21,代碼來源:SetupWizardLayout.java

示例2: findViewFromViewStub

import android.view.ViewStub; //導入方法依賴的package包/類
/**
 * inflate ViewStub 並返回對應的 View。
 */
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:QMUI,項目名稱:QMUI_Android,代碼行數:24,代碼來源:QMUIViewHelper.java

示例3: updateMostVisitedPlaceholderVisibility

import android.view.ViewStub; //導入方法依賴的package包/類
/**
 * Shows the most visited placeholder ("Nothing to see here") if there are no most visited
 * items and there is no search provider logo.
 */
private void updateMostVisitedPlaceholderVisibility() {
    boolean showPlaceholder = mHasReceivedMostVisitedSites
            && mMostVisitedLayout.getChildCount() == 0
            && !mSearchProviderHasLogo;

    mNoSearchLogoSpacer.setVisibility(
            (mSearchProviderHasLogo || showPlaceholder) ? View.GONE : View.INVISIBLE);

    if (showPlaceholder) {
        if (mMostVisitedPlaceholder == null) {
            ViewStub mostVisitedPlaceholderStub = (ViewStub) mNewTabPageLayout
                    .findViewById(R.id.most_visited_placeholder_stub);

            mMostVisitedPlaceholder = mostVisitedPlaceholderStub.inflate();
        }
        mMostVisitedLayout.setVisibility(GONE);
        mMostVisitedPlaceholder.setVisibility(VISIBLE);
    } else if (mMostVisitedPlaceholder != null) {
        mMostVisitedLayout.setVisibility(VISIBLE);
        mMostVisitedPlaceholder.setVisibility(GONE);
    }
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:27,代碼來源:NewTabPageView.java

示例4: setContentView

import android.view.ViewStub; //導入方法依賴的package包/類
@Override
public void setContentView(@LayoutRes int layoutResID) {
    super.setContentView(layoutResID);
    baseLayout = (RelativeLayout) LayoutInflater.from(this).inflate(R.layout.activity_base, null);
    setContentView(baseLayout);
    toolbar = (Toolbar) findViewById(R.id.toolbar);
    tvToolbarTitle = (TextView) findViewById(R.id.tvToolbarTitle);
    tvActionButton = (TextView) findViewById(R.id.tvActionButton);
    tvActionDescription = (TextView) findViewById(R.id.tvActionDescription);
    tvAbout = (TextView) findViewById(R.id.tvAbout);
    rlUserAction = (RelativeLayout) findViewById(R.id.rlUserAction);
    rlContainer = (RelativeLayout) findViewById(R.id.rlContainer);
    ivToolbarImage = (ImageView) findViewById(R.id.ivToolbarImage);
    setSupportActionBar(toolbar);
    ViewStub stub = (ViewStub) baseLayout.findViewById(R.id.container);
    stub.setLayoutResource(layoutResID);
    stub.inflate();
    ButterKnife.bind(this);
}
 
開發者ID:mayuroks,項目名稱:Coin-Tracker,代碼行數:20,代碼來源:BaseActivity.java

示例5: createGraphObjectView

import android.view.ViewStub; //導入方法依賴的package包/類
protected View createGraphObjectView(T graphObject) {
    View result = inflater.inflate(getGraphObjectRowLayoutId(graphObject), null);

    ViewStub checkboxStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_checkbox_stub);
    if (checkboxStub != null) {
        if (!getShowCheckbox()) {
            checkboxStub.setVisibility(View.GONE);
        } else {
            CheckBox checkBox = (CheckBox) checkboxStub.inflate();
            updateCheckboxState(checkBox, false);
        }
    }

    ViewStub profilePicStub = (ViewStub) result.findViewById(R.id.com_facebook_picker_profile_pic_stub);
    if (!getShowPicture()) {
        profilePicStub.setVisibility(View.GONE);
    } else {
        ImageView imageView = (ImageView) profilePicStub.inflate();
        imageView.setVisibility(View.VISIBLE);
    }

    return result;
}
 
開發者ID:MobileDev418,項目名稱:chat-sdk-android-push-firebase,代碼行數:24,代碼來源:GraphObjectAdapter.java

示例6: setDetailsLayout

import android.view.ViewStub; //導入方法依賴的package包/類
public boolean setDetailsLayout(int detailsLayoutId) {
    // Log.d(TAG,"setDetailsLayout "+detailsLayoutId);

    ViewStub detailsStub = (ViewStub) findViewById(R.id.info_details_stub);
    if (detailsStub == null) {
    	if(DBG) Log.e(TAG, "setDetailsLayout: detailsStub is null, returning false");
        return false;
    }
    if (detailsLayoutId == 0) {
    	if(DBG) Log.e(TAG, "setDetailsLayout: detailsLayoutId is zero, returning false");
        return false;
    }

    // First hide the "processing..." view
    if (mDetailsProcessingView != null) {
        mDetailsProcessingView.setVisibility(View.GONE);
    }
    // Then inflate the detailled infos
    if ((detailsStub != null) && (detailsLayoutId != 0)) {
        detailsStub.setLayoutResource(detailsLayoutId);
        detailsStub.inflate();
    } else {
    	if(DBG) Log.w(TAG, "setDetailsLayout: detailsStub=" + detailsStub + " / "
                + "detailsLayoutId=" + detailsLayoutId);
    }
    return true;
}
 
開發者ID:archos-sa,項目名稱:aos-MediaLib,代碼行數:28,代碼來源:InfoDialog.java

示例7: displayFailPage

import android.view.ViewStub; //導入方法依賴的package包/類
protected void displayFailPage(){
    // Hide content, show message
    mArchosGridView.setVisibility(View.GONE);
    View emptyView = mRootView.findViewById(R.id.empty_view);
    if (emptyView instanceof ViewStub) {
        final ViewStub stub = (ViewStub) emptyView;
        emptyView = stub.inflate();
    }

    View loading = mRootView.findViewById(R.id.loading);
    if (loading != null)
        loading.setVisibility(View.GONE);

    if (emptyView != null) {
        emptyView.setVisibility(View.VISIBLE);
        // Update the text of the empty view
        TextView emptyViewText = (TextView)emptyView.findViewById(R.id.empty_view_text);
        emptyViewText.setTextAppearance(getActivity(), android.R.style.TextAppearance_Large);
        emptyViewText.setText(R.string.network_timeout);
        // Check if a button is needed in the empty view
        Button emptyViewButton = (Button)emptyView.findViewById(R.id.empty_view_button);
        // Show the button and update its label
        emptyViewButton.setVisibility(View.VISIBLE);
        emptyViewButton.setText(getEmptyViewButtonLabel());
        emptyViewButton.setOnClickListener(mEmptyViewButtonClickListener);
    }
}
 
開發者ID:archos-sa,項目名稱:aos-Video,代碼行數:28,代碼來源:Browser.java

示例8: onViewCreated

import android.view.ViewStub; //導入方法依賴的package包/類
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    ButterKnife.bind(this, view);

    ViewStub stub = ButterKnife.findById(view, R.id.stub);
    stub.inflate();

    ViewStub stubWithFontPath = ButterKnife.findById(view, R.id.stub_with_font_path);
    stubWithFontPath.inflate();
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:12,代碼來源:PlaceholderFragment.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,代碼來源:DataListFragment.java

示例10: 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

示例11: 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

示例12: inflateViewStubInCreateView

import android.view.ViewStub; //導入方法依賴的package包/類
@Override
protected void inflateViewStubInCreateView(View root) {
    super.inflateViewStubInCreateView(root);
    ViewStub stub = (ViewStub) root.findViewById(R.id.lay_content);
    stub.setLayoutResource(getContentLayoutId());
    stub.inflate();
}
 
開發者ID:coding-dream,項目名稱:TPlayer,代碼行數:8,代碼來源:BaseTitleFragment.java

示例13: findViews

import android.view.ViewStub; //導入方法依賴的package包/類
private void findViews() {
    imageView = findView(R.id.chat_room_view);
    statusText = findView(R.id.online_status);
    final ImageView backImage = findView(R.id.back_arrow);
    tabs = findView(R.id.chat_room_tabs);
    viewPager = findView(R.id.chat_room_viewpager);

    backImage.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            NIMClient.getService(ChatRoomService.class).exitChatRoom(((ChatRoomActivity) getActivity()).getRoomInfo().getRoomId());
            ((ChatRoomActivity) getActivity()).clearChatRoom();
        }
    });

    // 是否演示彈幕控件
    if (SHOW_BARRAGE) {
        ViewStub barrageViewStub = findView(R.id.barrage_view_stub);
        barrageViewStub.inflate();

        View barrageViewRoot = findView(R.id.barrage_view_after_inflate);
        final BarrageSurfaceView barrageView = (BarrageSurfaceView) barrageViewRoot.findViewById(R.id.barrage_view);

        final String barrageText1 = "歡迎進入直播間";
        final String barrageText2 = "Welcome to live room";
        Handlers.sharedHandler(getActivity()).postDelayed(new Runnable() {
            @Override
            public void run() {
                BarrageConfig config = new BarrageConfig();
                config.setDuration(4500);
                // 初始化彈幕控件
                barrageView.init(config);
                for (int i = 1; i <= 200; i++) {
                    barrageView.addTextBarrage((i % 2 == 0 ? barrageText1 : barrageText2) + i);
                }
            }
        }, 1000);
    }
}
 
開發者ID:newDeepLearing,項目名稱:decoy,代碼行數:40,代碼來源:ChatRoomFragment.java

示例14: 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

示例15: onCreate

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

//        context = getApplicationContext();
//        Button button = (Button) findViewById(R.id.test);
//        button.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                NotificationCompat.Builder mBuilder =
//                        new NotificationCompat.Builder(context)
//                                .setSmallIcon(R.drawable.notification_icon)
//                                .setContentTitle("My notification")
//                                .setSound(Settings.System.DEFAULT_NOTIFICATION_URI)
//                                .setContentText("Hello World!");
//                Intent resultIntent = new Intent(context, AllArticlesListViewActivity.class);
//
//                // The stack builder object will contain an artificial back stack for the
//                // started Activity.
//                // This ensures that navigating backward from the Activity leads out of
//                // your application to the Home screen.
//                TaskStackBuilder stackBuilder = TaskStackBuilder.create(context);
//                // Adds the back stack for the Intent (but not the Intent itself)
//                stackBuilder.addParentStack(AllArticlesListViewActivity.class);
//                // Adds the Intent that starts the Activity to the top of the stack
//                stackBuilder.addNextIntent(resultIntent);
//                PendingIntent resultPendingIntent =
//                        stackBuilder.getPendingIntent(
//                                0,
//                                PendingIntent.FLAG_UPDATE_CURRENT
//                        );
//                mBuilder.setContentIntent(resultPendingIntent);
//                NotificationManager mNotificationManager =
//                        (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
//                // mId allows you to update the notification later on.
//                mNotificationManager.notify(1, mBuilder.build());
//            }
//        });
        //------------------------------



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

        // group name from user's input
        groupName = this.getIntent().getStringExtra("created_group_name");
        // list of selected checkboxes's ids
        listOfIdsLessons = this.getIntent().getStringExtra("list_of_ids");

        Button buttonSetupReminder = (Button) findViewById(R.id.buttonSetupReminder);
        buttonSetupReminder.setOnClickListener(new AdderReminder(groupName));

        //status of operation: new record or update
        StatusOfDatabaseOperation statusOperation = (StatusOfDatabaseOperation) this.
                getIntent().
                getSerializableExtra("status_operation");


        // show name of group lesson on form textview
        TextView textViewNameNewGroup = (TextView) findViewById(R.id.textViewNameNewGroup);
        textViewNameNewGroup.setText(groupName);

        // save the group lesson to database
        Button saveGroupButton = (Button) findViewById(R.id.saveButtonGroup);

        if (statusOperation == StatusOfDatabaseOperation.NEW) {
            saveGroupButton.setOnClickListener(saveGroupListener);
            saveGroupButton.setText(getString(R.string.save_group));
            initToolbarWithBackButton(null);
        } else {
            if (statusOperation == StatusOfDatabaseOperation.UPDATE) {
                long idGroupToBeUpdated = this.getIntent().getLongExtra("id_group_to_be_updated", -1);
                initToolbarWithBackButton(getString(R.string.text_about_updating));
                saveGroupButton.setText(getString(R.string.update_group));
                saveGroupButton.setOnClickListener(new UpdaterLessonGroupListener(idGroupToBeUpdated));
            }
        }
    }
 
開發者ID:white-collar,項目名稱:mobile-grammar,代碼行數:82,代碼來源:AddReminderToGroupActivity.java


注:本文中的android.view.ViewStub.inflate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。