当前位置: 首页>>代码示例>>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;未经允许,请勿转载。