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


Java LayoutParams.MATCH_PARENT屬性代碼示例

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


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

示例1: addChildView

/**
 * Inflates the child view of a tab and adds it to the view hierarchy.
 *
 * @param tabItem
 *         The tab item, which corresponds to the tab, whose child view should be inflated, as
 *         an instance of the class {@link TabItem}. The tab item may not be null
 */
private void addChildView(@NonNull final TabItem tabItem) {
    PhoneTabViewHolder viewHolder = tabItem.getViewHolder();
    View view = viewHolder.child;
    Tab tab = tabItem.getTab();

    if (view == null) {
        ViewGroup parent = viewHolder.childContainer;
        Pair<View, ?> pair = childViewRecycler.inflate(tab, parent);
        view = pair.first;
        LayoutParams layoutParams =
                new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
        layoutParams.setMargins(model.getPaddingLeft(), model.getPaddingTop(),
                model.getPaddingRight(), model.getPaddingBottom());
        parent.addView(view, 0, layoutParams);
        viewHolder.child = view;
    } else {
        childViewRecycler.getAdapter().onShowView(model.getContext(), view, tab, false);
    }

    viewHolder.previewImageView.setVisibility(View.GONE);
    viewHolder.previewImageView.setImageBitmap(null);
    viewHolder.borderView.setVisibility(View.GONE);
}
 
開發者ID:NeoTerm,項目名稱:NeoTerm,代碼行數:30,代碼來源:PhoneRecyclerAdapter.java

示例2: onCreate

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_web);
    ButterKnife.bind(this);

    initializeToolbar();

    mWebView = new WebView(this);
    LayoutParams lp = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    mWebView.setLayoutParams(lp);
    mContainer.addView(mWebView, 0);

    if (Colorful.getThemeDelegate().isNight()) {
        mContainer.setAlpha(0.7f);
    }

    if (getSupportActionBar() != null)
        getSupportActionBar().setTitle(getIntent().getStringExtra("title"));

    initWebView(getIntent().getStringExtra("url"));
}
 
開發者ID:woxingxiao,項目名稱:GracefulMovies,代碼行數:22,代碼來源:WebActivity.java

示例3: BasicNativePage

public BasicNativePage(Activity activity, Tab tab) {
    initialize(activity, tab);
    mActivity = activity;
    mTab = tab;
    mBackgroundColor = ApiCompatibilityUtils.getColor(activity.getResources(),
            R.color.default_primary_color);
    mThemeColor = ApiCompatibilityUtils.getColor(
            activity.getResources(), R.color.default_primary_color);

    Resources res = mActivity.getResources();

    LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT,
            LayoutParams.MATCH_PARENT);
    layoutParams.setMargins(0,
            res.getDimensionPixelSize(R.dimen.tab_strip_height)
            + res.getDimensionPixelSize(R.dimen.toolbar_height_no_shadow),
            0, 0);
    getView().setLayoutParams(layoutParams);
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:19,代碼來源:BasicNativePage.java

示例4: addContentView

/**
 * Inflates the view, which is associated with a tab, and adds it to the view hierarchy.
 *
 * @param tabItem
 *         The tab item, which corresponds to the tab, whose associated view should be inflated,
 *         as an instance of the class {@link TabItem}. The tab item may not be null
 */
private void addContentView(@NonNull final TabItem tabItem) {
    PhoneTabViewHolder viewHolder = (PhoneTabViewHolder) tabItem.getViewHolder();
    View view = viewHolder.content;
    Tab tab = tabItem.getTab();

    if (view == null) {
        ViewGroup parent = viewHolder.contentContainer;
        Pair<View, ?> pair = tabViewRecycler.inflate(tab, parent);
        view = pair.first;
        LayoutParams layoutParams =
                new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
        Rect padding = getPadding();
        layoutParams.setMargins(padding.left, padding.top, padding.right, padding.bottom);
        parent.addView(view, 0, layoutParams);
        viewHolder.content = view;
    } else {
        tabViewRecycler.getAdapter().onShowView(getModel().getContext(), view, tab, false);
    }

    viewHolder.previewImageView.setVisibility(View.GONE);
    viewHolder.previewImageView.setImageBitmap(null);
    viewHolder.borderView.setVisibility(View.GONE);
}
 
開發者ID:michael-rapp,項目名稱:ChromeLikeTabSwitcher,代碼行數:30,代碼來源:PhoneTabRecyclerAdapter.java

示例5: onShowTabView

@Override
protected final void onShowTabView(@NonNull final View view, @NonNull final TabItem tabItem,
                                   @NonNull final Integer... params) {
    LayoutParams layoutParams =
            new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    int borderMargin = -(tabInset + tabBorderWidth);
    int bottomMargin = params.length > 0 && params[0] != -1 ? params[0] : borderMargin;
    layoutParams.leftMargin = borderMargin;
    layoutParams.topMargin = -(tabInset + tabTitleContainerHeight);
    layoutParams.rightMargin = borderMargin;
    layoutParams.bottomMargin = bottomMargin;
    view.setLayoutParams(layoutParams);
    adaptContentBackgroundColor(tabItem);
    adaptBackgroundVisibility(tabItem);

    if (!getModel().isSwitcherShown()) {
        addContentView(tabItem);
    } else {
        renderPreview(tabItem);
    }
}
 
開發者ID:michael-rapp,項目名稱:ChromeLikeTabSwitcher,代碼行數:21,代碼來源:PhoneTabRecyclerAdapter.java

示例6: setupStatusBarView

private void setupStatusBarView(Context context, ViewGroup decorViewGroup) {
    mStatusBarTintView = new View(context);
    LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, mConfig.getStatusBarHeight());
    params.gravity = Gravity.TOP;
    if (mNavBarAvailable && !mConfig.isNavigationAtBottom()) {
        params.rightMargin = mConfig.getNavigationBarWidth();
    }
    mStatusBarTintView.setLayoutParams(params);
    mStatusBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR);
    mStatusBarTintView.setVisibility(View.GONE);
    decorViewGroup.addView(mStatusBarTintView);
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:12,代碼來源:SystemBarTintManager.java

示例7: setupStatusBarView

private void setupStatusBarView(Context context, ViewGroup decorViewGroup) {
  mStatusBarTintView = new View(context);
  LayoutParams params = new LayoutParams(LayoutParams.MATCH_PARENT, mConfig.getStatusBarHeight());
  params.gravity = Gravity.TOP;
  if (mNavBarAvailable && !mConfig.isNavigationAtBottom()) {
    params.rightMargin = mConfig.getNavigationBarWidth();
  }
  mStatusBarTintView.setLayoutParams(params);
  mStatusBarTintView.setBackgroundColor(DEFAULT_TINT_COLOR);
  mStatusBarTintView.setVisibility(View.GONE);
  decorViewGroup.addView(mStatusBarTintView);
}
 
開發者ID:Lingzh0ng,項目名稱:BrotherWeather,代碼行數:12,代碼來源:SystemBarTintManager.java

示例8: setFullscreenManager

/**
 * @param manager The fullscreen manager that should be notified of changes to this tab (if
 *                set to null, no more updates will come from this tab).
 */
public void setFullscreenManager(FullscreenManager manager) {
    mFullscreenManager = manager;
    if (mFullscreenManager != null) {
        boolean topOffsetsInitialized = !Float.isNaN(mPreviousTopControlsOffsetY)
                && !Float.isNaN(mPreviousContentOffsetY);
        boolean bottomOffsetsInitialized =
                !Float.isNaN(mPreviousBottomControlsOffsetY);
        boolean isChromeHomeEnabled = FeatureUtilities.isChromeHomeEnabled();

        // Make sure the dominant control offsets have been set.
        if ((!topOffsetsInitialized && !isChromeHomeEnabled)
                || (!bottomOffsetsInitialized && isChromeHomeEnabled)) {
            mFullscreenManager.setPositionsForTabToNonFullscreen();
        } else {
            mFullscreenManager.setPositionsForTab(mPreviousTopControlsOffsetY,
                    mPreviousBottomControlsOffsetY,
                    mPreviousContentOffsetY);
        }
        updateFullscreenEnabledState();
    }

    // For blimp mode, offset the blimp view by the height of browser controls. This will ensure
    // that the view doesn't get clipped at the bottom of the page and also the touch offsets
    // would work correctly.
    if (getBlimpContents() != null && mFullscreenManager != null) {
        ViewGroup blimpView = getBlimpContents().getView();
        FrameLayout.LayoutParams lp = (FrameLayout.LayoutParams) blimpView.getLayoutParams();
        if (lp == null) {
            lp = new FrameLayout.LayoutParams(
                    LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
        }

        lp.topMargin = mFullscreenManager.getTopControlsHeight();
        blimpView.setLayoutParams(lp);
    }
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:40,代碼來源:Tab.java

示例9: onShowView

@Override
public final void onShowView(@NonNull final Context context, @NonNull final View view,
                             @NonNull final TabItem tabItem, final boolean inflated,
                             @NonNull final Integer... params) {
    PhoneTabViewHolder viewHolder = (PhoneTabViewHolder) view.getTag(R.id.tag_view_holder);

    if (!tabItem.isInflated()) {
        tabItem.setView(view);
        tabItem.setViewHolder(viewHolder);
        view.setTag(R.id.tag_properties, tabItem.getTag());
    }

    LayoutParams layoutParams =
            new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
    int borderMargin = -(tabInset + tabBorderWidth);
    int bottomMargin = params.length > 0 && params[0] != -1 ? params[0] : borderMargin;
    layoutParams.leftMargin = borderMargin;
    layoutParams.topMargin = -(tabInset + tabTitleContainerHeight);
    layoutParams.rightMargin = borderMargin;
    layoutParams.bottomMargin = bottomMargin;
    view.setLayoutParams(layoutParams);
    Tab tab = tabItem.getTab();
    tab.addCallback(this);
    adaptTitle(viewHolder, tab);
    adaptIcon(viewHolder, tab);
    adaptCloseButton(viewHolder, tab);
    adaptCloseButtonIcon(viewHolder, tab);
    adaptBackgroundColor(view, viewHolder, tab);
    adaptTitleTextColor(viewHolder, tab);
    adaptSelectionState(viewHolder, tab);

    if (!model.isSwitcherShown()) {
        if (tab == model.getSelectedTab()) {
            addChildView(tabItem);
        }
    } else {
        renderChildView(tabItem);
    }
}
 
開發者ID:NeoTerm,項目名稱:NeoTerm,代碼行數:39,代碼來源:PhoneRecyclerAdapter.java


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