类android.view.ViewStub源码实例Demo

下面列出了怎么用android.view.ViewStub的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: arcusandroid   文件: ScleraSheet.java
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    View sheet = super.onCreateView(inflater, container, savedInstanceState);

    this.closeBox = (ImageView) sheet.findViewById(R.id.close);
    this.arcusIconTitle = (ImageView) sheet.findViewById(R.id.arcus_icon_title);
    this.textTitle = (ScleraTextView) sheet.findViewById(R.id.text_title);

    // Inflate the sheet's contents
    ViewStub sheetContents = (ViewStub) sheet.findViewById(R.id.sclera_sheet_contents);
    sheetContents.setLayoutResource(getSheetLayoutId());
    sheetContents.inflate();

    return sheet;
}
 
源代码2 项目: Klyph   文件: GraphObjectAdapter.java
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;
}
 
源代码3 项目: FimiX8-RE   文件: X8MainCameraSettingController.java
public void initViews(View rootView) {
    this.handleView = rootView.findViewById(R.id.x8_camera_setting_layout);
    this.rlCameraSetting = rootView.findViewById(R.id.x8_rl_main_camera_setting);
    this.cameraSettingblank = rootView.findViewById(R.id.x8_rl_main_camera_setting_blank);
    this.contentView = rootView.findViewById(R.id.rl_main_camera_setting_content);
    this.otherSettingStub = (ViewStub) rootView.findViewById(R.id.stub_camera_other_setting);
    this.x8ISOViewStub = (ViewStub) rootView.findViewById(R.id.stub_camera_iso_setting);
    this.modleStub = (ViewStub) rootView.findViewById(R.id.stub_camera_mode_setting);
    this.camerSetting = (ImageView) rootView.findViewById(R.id.camera_setting_btn);
    this.recordSetting = (ImageView) rootView.findViewById(R.id.record_setting_btn);
    this.otherSetting = (ImageView) rootView.findViewById(R.id.other_setting_btn);
    this.cameraSettingblank.setVisibility(0);
    View view = this.otherSettingStub.inflate();
    View isoView = this.x8ISOViewStub.inflate();
    View modeView = this.modleStub.inflate();
    if (this.otherSettingView == null) {
        this.otherSettingView = view.findViewById(R.id.rl_main_camera_otherSetting_layout);
        this.otherSettingView.setVisibility(8);
    }
    if (this.paramView == null) {
        this.paramView = isoView.findViewById(R.id.camera_params_setting);
    }
    if (this.modeSettingView == null) {
        this.modeSettingView = modeView.findViewById(R.id.x8_mode_setting_layout);
    }
}
 
源代码4 项目: android_tv_metro   文件: MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    setContentView(R.layout.activity_main);

    mTabHost = (TabHost)findViewById(android.R.id.tabhost);
    mTabHost.setup();
    mTabs    = (TabWidget)findViewById(android.R.id.tabs);

    ViewStub vStub = (ViewStub) findViewById(R.id.new_home_menu);
    mMenuContainer = (FrameLayout) vStub.inflate();
    mViewPager = (ViewPager)findViewById(R.id.pager);

    mLoadingView = makeEmptyLoadingView(this, (RelativeLayout)findViewById(R.id.tabs_content));

    setScrollerTime(800);

    albumItem = (DisplayItem) getIntent().getSerializableExtra("item");
    setUserFragmentClass();
    getSupportLoaderManager().initLoader(TabsGsonLoader.LOADER_ID, null, this);

    if (savedInstanceState != null) {
        mTabHost.setCurrentTabByTag(savedInstanceState.getString("tab"));
    }
}
 
源代码5 项目: Paginize   文件: BaseInnerPage.java
private void showLoadingViewInternal(CharSequence text) {
  if (mLayoutLoading == null) {
    mLayoutLoading = ((ViewStub) findViewById(R.id.paginize_contrib_stub_loading_layout)).inflate();
  }

  if (mLayoutContainer != null && mLayoutContainer.getVisibility() != View.GONE) {
    mLayoutContainer.setVisibility(View.GONE);
  }

  if (mLayoutError != null && mLayoutError.getVisibility() != View.GONE) {
    mLayoutError.setVisibility(View.GONE);
    mLayoutError.startAnimation(getAminFadeOut());
  }

  TextView tvLoading = (TextView)mLayoutLoading.findViewById(R.id.paginize_contrib_tv_loading_text);
  if (text != null) {
    tvLoading.setVisibility(View.VISIBLE);
    tvLoading.setText(text);
  } else {
    tvLoading.setVisibility(View.GONE);
  }

  mLayoutLoading.setVisibility(View.VISIBLE);
}
 
源代码6 项目: Silence   文件: ConversationItem.java
@Override
protected void onFinishInflate() {
  super.onFinishInflate();

  initializeAttributes();

  this.bodyText                = (TextView)           findViewById(R.id.conversation_item_body);
  this.dateText                = (TextView)           findViewById(R.id.conversation_item_date);
  this.simInfoText             = (TextView)           findViewById(R.id.sim_info);
  this.indicatorText           = (TextView)           findViewById(R.id.indicator_text);
  this.groupStatusText         = (TextView)           findViewById(R.id.group_message_status);
  this.secureImage             = (ImageView)          findViewById(R.id.secure_indicator);
  this.deliveryStatusIndicator = (DeliveryStatusView) findViewById(R.id.delivery_status);
  this.alertView               = (AlertView)          findViewById(R.id.indicators_parent);
  this.contactPhoto            = (AvatarImageView)    findViewById(R.id.contact_photo);
  this.bodyBubble              =                      findViewById(R.id.body_bubble);
  this.mediaThumbnailStub      = new Stub<>((ViewStub) findViewById(R.id.image_view_stub));
  this.audioViewStub           = new Stub<>((ViewStub) findViewById(R.id.audio_view_stub));

  setOnClickListener(new ClickListener(null));

  bodyText.setOnLongClickListener(passthroughClickListener);
  bodyText.setOnClickListener(passthroughClickListener);
}
 
源代码7 项目: CloudReader   文件: BaseFragment.java
protected void showEmptyView(String text) {
    // 需要这样处理,否则二次显示会失败
    ViewStub viewStub = getView(R.id.vs_empty);
    if (viewStub != null) {
        emptyView = viewStub.inflate();
        ((TextView) emptyView.findViewById(R.id.tv_tip_empty)).setText(text);
    }
    if (emptyView != null) {
        emptyView.setVisibility(View.VISIBLE);
    }

    if (loadingView != null && loadingView.getVisibility() != View.GONE) {
        loadingView.setVisibility(View.GONE);
    }
    // 停止动画
    if (mAnimationDrawable != null && mAnimationDrawable.isRunning()) {
        mAnimationDrawable.stop();
    }
    if (errorView != null) {
        errorView.setVisibility(View.GONE);
    }
    if (bindingView != null && bindingView.getRoot().getVisibility() != View.GONE) {
        bindingView.getRoot().setVisibility(View.GONE);
    }
}
 
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;
}
 
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;
}
 
源代码10 项目: ForPDA   文件: NewsDetailsFragment.java
@Nullable
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    baseInflateFragment(inflater, R.layout.fragment_article);
    ViewStub viewStub = (ViewStub) findViewById(R.id.toolbar_content);
    viewStub.setLayoutResource(R.layout.toolbar_news_details);
    viewStub.inflate();
    fragmentsPager = (ViewPager) findViewById(R.id.view_pager);
    webViewContainer = (FrameLayout) findViewById(R.id.swipe_refresh_list);
    progressBar = (ProgressBar) findViewById(R.id.progress_bar);
    detailsImage = (ImageView) findViewById(R.id.article_image);
    detailsTitle = (TextView) findViewById(R.id.article_title);
    detailsNick = (TextView) findViewById(R.id.article_nick);
    detailsCount = (TextView) findViewById(R.id.article_comments_count);
    detailsDate = (TextView) findViewById(R.id.article_date);
    imageProgressBar = (ProgressBar) findViewById(R.id.article_progress_bar);

    detailsImage.setMaxHeight(App.px24 * 10);

    AppBarLayout.LayoutParams params = (AppBarLayout.LayoutParams) toolbarLayout.getLayoutParams();
    params.setScrollFlags(AppBarLayout.LayoutParams.SCROLL_FLAG_SCROLL | AppBarLayout.LayoutParams.SCROLL_FLAG_EXIT_UNTIL_COLLAPSED);
    toolbarLayout.setLayoutParams(params);

    return view;
}
 
源代码11 项目: Common   文件: ViewHelper.java
/**
 * 把 ViewStub inflate 之后在其中根据 id 找 View
 *
 * @param parentView     包含 ViewStub 的 View
 * @param viewStubId     要从哪个 ViewStub 来 inflate
 * @param inflatedViewId 最终要找到的 View 的 id
 * @return id 为 inflatedViewId 的 View
 */
public static View findViewFromViewStub(View parentView, int viewStubId, int inflatedViewId) {
    if (null == parentView) {
        return null;
    }
    View view = parentView.findViewById(inflatedViewId);
    if (null == view) {
        ViewStub vs = (ViewStub) parentView.findViewById(viewStubId);
        if (null == vs) {
            return null;
        }
        view = vs.inflate();
        if (null != view) {
            view = view.findViewById(inflatedViewId);
        }
    }
    return view;
}
 
源代码12 项目: Common   文件: ViewHelper.java
/**
 * @param parentView
 * @param viewStubId
 * @param inflatedViewId
 * @param inflateLayoutResId
 * @return
 */
@SuppressLint("ResourceType")
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;
}
 
源代码13 项目: Tesseract-OCR-Scanner   文件: ScannerActivity.java
private void initView() {
    mQrCodeFinderView = (ScannerFinderView) findViewById(R.id.qr_code_view_finder);
    mSurfaceViewStub = (ViewStub) findViewById(R.id.qr_code_view_stub);
    switch1 = (Switch) findViewById(R.id.switch1);
    mHasSurface = false;

    bt = (Button) findViewById(R.id.bt);

    bt.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            bt.setEnabled(false);
            buildProgressDialog();
            CameraManager.get().takeShot(ScannerActivity.this, ScannerActivity.this, ScannerActivity.this);
        }
    });

    Switch switch2 = (Switch) findViewById(R.id.switch2);
    switch2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
        @Override
        public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
            CameraManager.get().setFlashLight(isChecked);
        }
    });
}
 
源代码14 项目: custom-typeface   文件: SecondActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    getLayoutInflater().setFactory(new CustomTypefaceFactory(
            this, CustomTypeface.getInstance()));

    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_second);

    findViewById(R.id.button).setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            v.setEnabled(false);
            ViewStub viewStub = (ViewStub) findViewById(R.id.view_stub);
            viewStub.inflate();
        }
    });
}
 
源代码15 项目: KlyphMessenger   文件: GraphObjectAdapter.java
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;
}
 
源代码16 项目: Paginize   文件: FramePage.java
private void showLoadingUIInternal(CharSequence text) {
  if (mLayoutLoading == null) {
    mLayoutLoading = ((ViewStub) findViewById(R.id.stub_loading_layout)).inflate();
  }

  if (mLayoutError != null && mLayoutError.getVisibility() != View.GONE) {
    mLayoutError.setVisibility(View.GONE);
    mLayoutError.startAnimation(getAminFadeOut());
  }

  if (text != null) {
    ((TextView)mLayoutLoading.findViewById(R.id.tv_loading_text)).setText(text);
  }

  mLayoutContainer.setVisibility(View.GONE);
  mLayoutContainer.startAnimation(getAminFadeOut());

  mLayoutLoading.setVisibility(View.VISIBLE);
}
 
源代码17 项目: Speculum-Android   文件: MainActivity.java
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    ((SpeculumApplication) getApplication()).createMainComponent(this).inject(this);
    Assent.setActivity(this, this);

    Configuration configuration = objectStore.get();
    boolean didLoadOldConfig = getIntent().getBooleanExtra(Constants.SAVED_CONFIGURATION_IDENTIFIER, false);

    ViewStub viewStub = configuration.isSimpleLayout() ?
            (ViewStub) findViewById(R.id.stub_simple) :
            (ViewStub) findViewById(R.id.stub_verbose);
    if (null != viewStub) viewStub.inflate();

    ButterKnife.bind(this);

    //never sleep
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON);

    if (didLoadOldConfig)
        showConfigurationSnackbar();

    presenter.setConfiguration(configuration);
}
 
源代码18 项目: DMusic   文件: ViewHelper.java
/**
 * 把 ViewStub inflate 之后在其中根据 id 找 View
 *
 * @param parentView     包含 ViewStub 的 View
 * @param viewStubId     要从哪个 ViewStub 来 inflate
 * @param inflatedViewId 最终要找到的 View 的 id
 * @return id 为 inflatedViewId 的 View
 */
public static View findViewFromViewStub(View parentView, int viewStubId, int inflatedViewId) {
    if (null == parentView) {
        return null;
    }
    View view = parentView.findViewById(inflatedViewId);
    if (null == view) {
        ViewStub vs = (ViewStub) parentView.findViewById(viewStubId);
        if (null == vs) {
            return null;
        }
        view = vs.inflate();
        if (null != view) {
            view = view.findViewById(inflatedViewId);
        }
    }
    return view;
}
 
源代码19 项目: IslamicLibraryAndroid   文件: BookmarkFragment.java
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
                         Bundle savedInstanceState) {
    View view = inflater.inflate(R.layout.fragment_bookmark_list, container, false);

    // Set the adapter
    RecyclerView recyclerView = view.findViewById(R.id.recyclerView);
    ViewStub zeroView = view.findViewById(R.id.zero_bookmarks);


    if (bookmarks.size() != 0) {
        recyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
        recyclerView.addItemDecoration(new DividerItemDecoration(getContext(), DividerItemDecoration.VERTICAL));
        recyclerView.setAdapter(bookmarkRecyclerViewAdapter);

    } else {
        recyclerView.setVisibility(View.GONE);
        zeroView.setVisibility(View.VISIBLE);
    }

    return view;
}
 
源代码20 项目: Abelana-Android   文件: GraphObjectAdapter.java
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;
}
 
源代码21 项目: arcusandroid   文件: ArcusProductFragment.java
@Override
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    View view = super.onCreateView(inflater, container, savedInstanceState);

    decimalFormat.setMaximumFractionDigits(1);
    decimalFormat.setRoundingMode(RoundingMode.HALF_UP);

    mView = view;
    deviceImage = (GlowableImageView) view.findViewById(R.id.fragment_device_info_image);
    seekArc = (DeviceSeekArc) view.findViewById(R.id.seekArc);
    topViewStub = (ViewStub) view.findViewById(R.id.top_part);
    justAMoment = view.findViewById(R.id.loading_label);
    waitingLabel = (Version1TextView) view.findViewById(R.id.waiting_on_label_device_details);

    deviceImageViewStub = (ViewStub) view.findViewById(R.id.device_image_part);

    statusViewStub = (ViewStub) view.findViewById(R.id.device_status_part);

    bottomView = view.findViewById(R.id.device_bottom_part);

    cloudIcon = (ImageView) view.findViewById(R.id.cloud_icon);
    productIcon = (ImageView) view.findViewById(R.id.product_icon);
    productBrandName = (TextView) view.findViewById(R.id.product_brand_name);

    leftNav = (ImageView) view.findViewById(R.id.left_nav);
    rightNav = (ImageView) view.findViewById(R.id.right_nav);

    viewPager = (ViewPager) getActivity().findViewById(R.id.fragment_device_detail_child_view_pager);

    return view;
}
 
源代码22 项目: arcusandroid   文件: HeaderContentPopup.java
@Override
public final void doContentSection() {
    ViewStub headerBlock = (ViewStub) contentView.findViewById(R.id.header_block);
    ViewStub contentDivider = (ViewStub) contentView.findViewById(R.id.header_content_divider);
    ViewStub contentBlock = (ViewStub) contentView.findViewById(R.id.content_block);

    Integer headerLayout = headerSectionLayout();
    if (headerLayout != null) {
        headerBlock.setLayoutResource(headerLayout);
        headerBlockView = headerBlock.inflate();
        setupHeaderSection(headerBlockView);
    }

    Integer dividerLayout = contentDividerLayout();
    if (dividerLayout != null) {
        contentDivider.setLayoutResource(dividerLayout);
        contentDividerView = contentDivider.inflate();
        setupDividerSection(contentDividerView);
    }

    Integer subContentLayout = subContentSectionLayout();
    if (subContentLayout != null) {
        contentBlock.setLayoutResource(subContentLayout);
        contentBlockView = contentBlock.inflate();
        setupSubContentSection(contentBlockView);
    }
}
 
@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);
    }

}
 
源代码24 项目: SimpleSmsRemote   文件: ModuleActivity.java
protected void setSettingsContentLayout(int layoutId) {
    findViewById(R.id.card_module_settings).setVisibility(View.VISIBLE);
    findViewById(R.id.textView_module_settings_title).setVisibility(View.VISIBLE);

    ViewStub settingsViewStub = (ViewStub) findViewById(R.id.viewStub_settings_content);
    settingsViewStub.setLayoutResource(layoutId);
    settingsViewStub.inflate();
}
 
源代码25 项目: materialup   文件: SearchActivity.java
private void setNoResultsVisibility(int visibility) {
    if (visibility == View.VISIBLE) {
        if (noResults == null) {
            noResults = (BaselineGridTextView) ((ViewStub)
                    findViewById(R.id.stub_no_search_results)).inflate();
            noResults.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    searchView.setQuery("", false);
                    searchView.requestFocus();
                    ImeUtils.showIme(searchView);
                }
            });
        }
        String message = String.format(getString(R
                .string.no_search_results), searchView.getQuery().toString());
        SpannableStringBuilder ssb = new SpannableStringBuilder(message);
        ssb.setSpan(new StyleSpan(Typeface.ITALIC),
                message.indexOf('“') + 1,
                message.length() - 1,
                Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
        noResults.setText(ssb);
    }
    if (noResults != null) {
        noResults.setVisibility(visibility);
    }
}
 
源代码26 项目: android   文件: RecentFragment.java
@Override
public void onInflate(ViewStub viewStub, View view) {
    TextView textView = (TextView) view.findViewById(R.id.text1);
    textView.setText(R.string.empty_recents);

    //Don't show the proxy option in an empty recent fragment
    RobotoCheckBox checkBox = (RobotoCheckBox) view.findViewById(R.id.checkBox1);
    checkBox.setVisibility(View.GONE);
}
 
源代码27 项目: v9porn   文件: ExoVideoView.java
/**
 * Inflates the video view layout, replacing the {@link ViewStub} with the
 * correct backing implementation.
 *
 * @param context            The context to use for inflating the correct video view
 * @param attributeContainer The attributes for retrieving custom backing implementations.
 */
protected void inflateVideoView(@NonNull Context context, @NonNull AttributeContainer attributeContainer) {
    View.inflate(context, R.layout.exomedia_video_view_layout, this);
    ViewStub videoViewStub = findViewById(R.id.video_view_api_impl_stub);

    videoViewStub.setLayoutResource(getVideoViewApiImplementation(context, attributeContainer));
    videoViewStub.inflate();
}
 
源代码28 项目: RunMap   文件: MovementTrackActivity.java
private void inflateDataUiLayout(){
    ViewStub viewStub = (ViewStub) findViewById(R.id.vs_data_ui_layout);
    if(viewStub == null){
        //already inflate
        return;
    }
    View dataUiRoot = viewStub.inflate();
    //初始化数据UI相关
    mViewGpsPower = dataUiRoot.findViewById(R.id.view_gps_power);
    mBtnChangeMapUi = (Button) dataUiRoot.findViewById(R.id.btn_change_to_map_ui);
    mTvDataMoveDistance = (TextView) dataUiRoot.findViewById(R.id.tv_data_ui_distance);
    mTvDataMoveTime = (TextView) dataUiRoot.findViewById(R.id.tv_data_ui_time);
    mBtnChangeMapUi.setOnClickListener(this);
}
 
源代码29 项目: RvHelper   文件: OptimumRecyclerView.java
private void initView() {
    if (isInEditMode()) {
        return;
    }
    View v = LayoutInflater.from(getContext()).inflate(R.layout.layout_rvhelper, this);

    //初始化加载中界面
    mLoadingViewStub = (ViewStub) v.findViewById(R.id.loading_view_stub);
    mLoadingViewStub.setLayoutResource(mLoadingId);
    if (0 != mLoadingId) {
        View loadingView = mLoadingViewStub.inflate();
        if (loadingView instanceof LoadingLayout) {
            mLoadingLayout = (LoadingLayout) loadingView;
        }
    }

    //初始化空白页面界面
    mEmptyViewStub = (ViewStub) v.findViewById(R.id.empty_view_stub);
    mEmptyViewStub.setLayoutResource(mEmptyId);
    if (0 != mEmptyId) {
        View emptyView = mEmptyViewStub.inflate();
        if (emptyView instanceof EmptyLayout) {
            mEmptyLayout = (EmptyLayout) emptyView;
        }
    }

    initPtrView(v);
    initRecyclerView(v);
    initLoadMoreView(v);

    //默认先显示加载中界面
    if (mLoadingSwitch) {
        showLoadingView();
    }
}
 
源代码30 项目: android-Stupid-Adapter   文件: MsgViewHodlerMap.java
@Override
public void onCreate(Context c) {
	viewStub_send = (ViewStub) findViewById(R.id.viewStub_send);
	viewStub_receive = (ViewStub) findViewById(R.id.viewStub_receive);
	system_msg = (TextView) findViewById(R.id.system_msg);
	getView().setOnClickListener(this);
}
 
 类所在包
 同包方法