当前位置: 首页>>代码示例>>Java>>正文


Java ApiCompatibilityUtils.setMarginStart方法代码示例

本文整理汇总了Java中org.chromium.base.ApiCompatibilityUtils.setMarginStart方法的典型用法代码示例。如果您正苦于以下问题:Java ApiCompatibilityUtils.setMarginStart方法的具体用法?Java ApiCompatibilityUtils.setMarginStart怎么用?Java ApiCompatibilityUtils.setMarginStart使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.chromium.base.ApiCompatibilityUtils的用法示例。


在下文中一共展示了ApiCompatibilityUtils.setMarginStart方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: adjustViewPosition

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
void adjustViewPosition() {
    mParent.getWindowVisibleDisplayFrame(mCurrentVisibleRect);
    // Only update if the visible frame has changed, otherwise there will be a layout loop.
    if (!mCurrentVisibleRect.equals(mPreviousVisibleRect)) {
        mPreviousVisibleRect.set(mCurrentVisibleRect);

        int keyboardHeight = mParent.getHeight() - mCurrentVisibleRect.bottom
                + mCurrentVisibleRect.top;
        MarginLayoutParams lp = getLayoutParams();
        lp.bottomMargin = keyboardHeight;
        if (mIsTablet) {
            int margin = mParent.getResources()
                    .getDimensionPixelSize(R.dimen.snackbar_margin_tablet);
            ApiCompatibilityUtils.setMarginStart(lp, margin);
            lp.bottomMargin += margin;
            int width = mParent.getResources()
                    .getDimensionPixelSize(R.dimen.snackbar_width_tablet);
            lp.width = Math.min(width, mParent.getWidth() - 2 * margin);
        }
        mView.setLayoutParams(lp);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:23,代码来源:SnackbarView.java

示例2: createAndAddLogoView

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
private static ImageView createAndAddLogoView(
        ViewGroup parent, int resourceId, int startMargin) {
    ImageView view = new ImageView(parent.getContext());
    view.setBackgroundResource(R.drawable.payments_ui_logo_bg);
    if (resourceId != 0) view.setImageResource(resourceId);

    // The logo has a pre-defined height and width.
    LayoutParams params = new LayoutParams(
            parent.getResources().getDimensionPixelSize(R.dimen.payments_section_logo_width),
            parent.getResources().getDimensionPixelSize(R.dimen.payments_section_logo_height));
    ApiCompatibilityUtils.setMarginStart(params, startMargin);
    parent.addView(view, params);
    return view;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:15,代码来源:PaymentRequestSection.java

示例3: createAndAddEditButton

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
private Button createAndAddEditButton(ViewGroup parent) {
    Resources resources = parent.getResources();
    Button view = DualControlLayout.createButtonForLayout(
            parent.getContext(), true, resources.getString(R.string.select), this);
    view.setId(R.id.payments_section);

    LayoutParams params =
            new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    ApiCompatibilityUtils.setMarginStart(params, mLargeSpacing);
    parent.addView(view, params);
    return view;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:13,代码来源:PaymentRequestSection.java

示例4: createAndAddChevron

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
private ImageView createAndAddChevron(ViewGroup parent) {
    Resources resources = parent.getResources();
    TintedDrawable chevron = TintedDrawable.constructTintedDrawable(
            resources, R.drawable.ic_expanded, R.color.payments_section_chevron);

    ImageView view = new ImageView(parent.getContext());
    view.setImageDrawable(chevron);

    // Wrap whatever image is passed in.
    LayoutParams params =
            new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    ApiCompatibilityUtils.setMarginStart(params, mLargeSpacing);
    parent.addView(view, params);
    return view;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:16,代码来源:PaymentRequestSection.java

示例5: SectionSeparator

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/** Creates the View and adds it to the parent at the given index. */
public SectionSeparator(ViewGroup parent, int index) {
    super(parent.getContext());
    Resources resources = parent.getContext().getResources();
    setBackgroundColor(ApiCompatibilityUtils.getColor(
            resources, R.color.payments_section_separator));
    LinearLayout.LayoutParams params = new LinearLayout.LayoutParams(
            LayoutParams.MATCH_PARENT,
            resources.getDimensionPixelSize(R.dimen.payments_section_separator_height));

    int margin = resources.getDimensionPixelSize(R.dimen.payments_section_large_spacing);
    ApiCompatibilityUtils.setMarginStart(params, margin);
    ApiCompatibilityUtils.setMarginEnd(params, margin);
    parent.addView(this, index, params);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:16,代码来源:PaymentRequestSection.java

示例6: prepareMainSection

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
 * Creates the main section.  Subclasses must call super#createMainSection() immediately to
 * guarantee that Views are added in the correct order.
 *
 * @param sectionName Title to display for the section.
 */
private LinearLayout prepareMainSection(String sectionName) {
    // The main section is a vertical linear layout that subclasses can append to.
    LinearLayout mainSectionLayout = new LinearLayout(getContext());
    mainSectionLayout.setOrientation(VERTICAL);
    LinearLayout.LayoutParams mainParams = new LayoutParams(0, LayoutParams.WRAP_CONTENT);
    mainParams.weight = 1;
    addView(mainSectionLayout, mainParams);

    // The title is always displayed for the row at the top of the main section.
    mTitleView = new TextView(getContext());
    mTitleView.setText(sectionName);
    ApiCompatibilityUtils.setTextAppearance(
            mTitleView, R.style.PaymentsUiSectionHeader);
    mainSectionLayout.addView(
            mTitleView, new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));

    // Create the two TextViews for showing the summary text.
    mSummaryLeftTextView = new TextView(getContext());
    mSummaryLeftTextView.setId(R.id.payments_left_summary_label);
    ApiCompatibilityUtils.setTextAppearance(
            mSummaryLeftTextView, R.style.PaymentsUiSectionDefaultText);

    mSummaryRightTextView = new TextView(getContext());
    ApiCompatibilityUtils.setTextAppearance(
            mSummaryRightTextView, R.style.PaymentsUiSectionDefaultText);
    ApiCompatibilityUtils.setTextAlignment(mSummaryRightTextView, TEXT_ALIGNMENT_TEXT_END);

    // The main TextView sucks up all the available space.
    LinearLayout.LayoutParams leftLayoutParams = new LinearLayout.LayoutParams(
            0, LayoutParams.WRAP_CONTENT);
    leftLayoutParams.weight = 1;

    LinearLayout.LayoutParams rightLayoutParams = new LinearLayout.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
    ApiCompatibilityUtils.setMarginStart(
            rightLayoutParams,
            getContext().getResources().getDimensionPixelSize(
                    R.dimen.payments_section_small_spacing));

    // The summary section displays up to two TextViews side by side.
    mSummaryLayout = new LinearLayout(getContext());
    mSummaryLayout.addView(mSummaryLeftTextView, leftLayoutParams);
    mSummaryLayout.addView(mSummaryRightTextView, rightLayoutParams);
    mainSectionLayout.addView(mSummaryLayout, new LinearLayout.LayoutParams(
            LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
    setSummaryText(null, null);

    createMainSectionContent(mainSectionLayout);
    return mainSectionLayout;
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:57,代码来源:PaymentRequestSection.java

示例7: update

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/**
 * Updates the total and how it's broken down.
 *
 * @param cart The shopping cart contents and the total.
 */
public void update(ShoppingCart cart) {
    Context context = mBreakdownLayout.getContext();

    CharSequence totalPrice = createValueString(
            cart.getTotal().getCurrency(), cart.getTotal().getPrice(), true);

    // Show the updated text view if the total changed.
    showUpdateIfTextChanged(totalPrice);

    // Update the summary to display information about the total.
    setSummaryText(cart.getTotal().getLabel(), totalPrice);

    mBreakdownLayout.removeAllViews();
    if (cart.getContents() == null) return;

    int maximumDescriptionWidthPx =
            ((View) mBreakdownLayout.getParent()).getWidth() * 2 / 3;

    // Update the breakdown, using one row per {@link LineItem}.
    int numItems = cart.getContents().size();
    mBreakdownLayout.setRowCount(numItems);
    for (int i = 0; i < numItems; i++) {
        LineItem item = cart.getContents().get(i);

        TextView description = new TextView(context);
        ApiCompatibilityUtils.setTextAppearance(description, item.getIsPending()
                        ? R.style.PaymentsUiSectionPendingTextEndAligned
                        : R.style.PaymentsUiSectionDescriptiveTextEndAligned);
        description.setText(item.getLabel());
        description.setEllipsize(TruncateAt.END);
        description.setMaxLines(2);
        if (maximumDescriptionWidthPx > 0) {
            description.setMaxWidth(maximumDescriptionWidthPx);
        }

        TextView amount = new TextView(context);
        ApiCompatibilityUtils.setTextAppearance(amount, item.getIsPending()
                        ? R.style.PaymentsUiSectionPendingTextEndAligned
                        : R.style.PaymentsUiSectionDescriptiveTextEndAligned);
        amount.setText(createValueString(item.getCurrency(), item.getPrice(), false));

        // Each item is represented by a row in the GridLayout.
        GridLayout.LayoutParams descriptionParams = new GridLayout.LayoutParams(
                GridLayout.spec(i, 1, GridLayout.END),
                GridLayout.spec(0, 1, GridLayout.END));
        GridLayout.LayoutParams amountParams = new GridLayout.LayoutParams(
                GridLayout.spec(i, 1, GridLayout.END),
                GridLayout.spec(1, 1, GridLayout.END));
        ApiCompatibilityUtils.setMarginStart(amountParams,
                context.getResources().getDimensionPixelSize(
                        R.dimen.payments_section_descriptive_item_spacing));

        mBreakdownLayout.addView(description, descriptionParams);
        mBreakdownLayout.addView(amount, amountParams);
    }
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:62,代码来源:PaymentRequestSection.java

示例8: expand

import org.chromium.base.ApiCompatibilityUtils; //导入方法依赖的package包/类
/** Expand the separator to be the full width of the dialog. */
public void expand() {
    LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) getLayoutParams();
    ApiCompatibilityUtils.setMarginStart(params, 0);
    ApiCompatibilityUtils.setMarginEnd(params, 0);
}
 
开发者ID:rkshuai,项目名称:chromium-for-android-56-debug-video,代码行数:7,代码来源:PaymentRequestSection.java


注:本文中的org.chromium.base.ApiCompatibilityUtils.setMarginStart方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。