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


Java View.getPaddingTop方法代码示例

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


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

示例1: addView

import android.view.View; //导入方法依赖的package包/类
void addView(final int position) {
	View root = createView(position, mParent);
	root.setOnTouchListener(this);
	root.setTag(R.id.cardstack_internal_position_tag, position);
	root.setLayerType(View.LAYER_TYPE_HARDWARE, null);

	mCardPaddingInternal = root.getPaddingTop();

	FrameLayout.LayoutParams lp = new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, fullCardHeight);
	root.setLayoutParams(lp);
	if (mShowInitAnimation) {
		root.setY(getCardFinalY(position));
		setScreenTouchable(false);
	} else {
		root.setY(getCardOriginalY(position) - mParentPaddingTop);
		setScreenTouchable(true);
	}

	mCardViews[position] = root;

	mParent.addView(root);
}
 
开发者ID:7763sea,项目名称:VirtualHook,代码行数:23,代码来源:CardStackAdapter.java

示例2: getAllChildrenHeightSum

import android.view.View; //导入方法依赖的package包/类
private int getAllChildrenHeightSum(boolean withPadding, boolean withMargin) {
    final int childCount = getChildCount();
    int height = 0;
    for (int i = 0; i < childCount; i++) {
        View child = getChildAt(i);
        if (child.getVisibility() == GONE)
            continue;

        int margin = ((MarginLayoutParams) child.getLayoutParams()).topMargin +
                ((MarginLayoutParams) child.getLayoutParams()).bottomMargin;

        height += child.getMeasuredHeight() +
                (withPadding ? child.getPaddingTop() + child.getPaddingBottom() : 0) +
                (withMargin ? margin : 0);
    }
    return Math.max(height, 0);
}
 
开发者ID:nowandfurure,项目名称:richeditor,代码行数:18,代码来源:LuBottomMenu.java

示例3: applyPadding

import android.view.View; //导入方法依赖的package包/类
/**
 * apply padding in view
 */
public static void applyPadding(View view, DynamicProperty property, int position) {
    if (view != null) {
        switch (property.type) {
            case DIMEN: {
                int[] padding = new int[] {
                  view.getPaddingLeft(),
                  view.getPaddingTop(),
                  view.getPaddingRight(),
                  view.getPaddingBottom()
                };
                padding[position] = property.getValueInt();
                view.setPadding(padding[0], padding[1], padding[2], padding[3]);
            }
            break;
        }
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:21,代码来源:DynamicHelper.java

示例4: getActivityLaunchOptions

import android.view.View; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.M)
public Bundle getActivityLaunchOptions(View v) {
    if (AndroidVersion.isAtLeastMarshmallow) {
        int left = 0, top = 0;
        int width = v.getMeasuredWidth(), height = v.getMeasuredHeight();
        if (v instanceof TextView) {
            // Launch from center of icon, not entire view
            Drawable icon = Workspace.getTextViewIcon((TextView) v);
            if (icon != null) {
                Rect bounds = icon.getBounds();
                left = (width - bounds.width()) / 2;
                top = v.getPaddingTop();
                width = bounds.width();
                height = bounds.height();
            }
        }
        return ActivityOptions.makeClipRevealAnimation(v, left, top, width, height).toBundle();
    } else if (AndroidVersion.isAtLeastLollipopMR1) {
        // On L devices, we use the device default slide-up transition.
        // On L MR1 devices, we use a custom version of the slide-up transition which
        // doesn't have the delay present in the device default.
        return ActivityOptions.makeCustomAnimation(
                this, R.anim.task_open_enter, R.anim.no_anim).toBundle();
    }
    return null;
}
 
开发者ID:enricocid,项目名称:LaunchEnr,代码行数:27,代码来源:Launcher.java

示例5: handleClickableSpan

import android.view.View; //导入方法依赖的package包/类
public static boolean handleClickableSpan(View view, Layout layout, Spannable buffer, MotionEvent event) {
  int action = event.getAction();

  if (action == MotionEvent.ACTION_UP ||
      action == MotionEvent.ACTION_DOWN) {
    int x = (int) event.getX();
    int y = (int) event.getY();

    x -= view.getPaddingLeft();
    y -= view.getPaddingTop();

    x += view.getScrollX();
    y += view.getScrollY();

    int line = layout.getLineForVertical(y);
    int off = layout.getOffsetForHorizontal(line, x);

    ClickableSpan[] link = buffer.getSpans(off, off, ClickableSpan.class);

    if (link.length != 0) {
      if (action == MotionEvent.ACTION_UP) {
        link[0].onClick(view);
      } else {
        Selection.setSelection(buffer,
            buffer.getSpanStart(link[0]),
            buffer.getSpanEnd(link[0]));
      }
      return true;
    } else {
      Selection.removeSelection(buffer);
    }
  }

  return false;
}
 
开发者ID:lsjwzh,项目名称:FastTextView,代码行数:36,代码来源:ClickableSpanUtil.java

示例6: setBackgroundDrawable

import android.view.View; //导入方法依赖的package包/类
public static void setBackgroundDrawable(View v, Drawable drawable) {
    if (v != null) {
        int paddingLeft = v.getPaddingLeft();
        int paddingTop = v.getPaddingTop();
        int paddingRight = v.getPaddingRight();
        int paddingBottom = v.getPaddingBottom();
        if (Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN)
            v.setBackgroundDrawable(drawable);
        else
            v.setBackground(drawable);

        v.setPadding(paddingLeft,
                paddingTop,
                paddingRight,
                paddingBottom);
    }
}
 
开发者ID:GlennioTech,项目名称:MetadataEditor,代码行数:18,代码来源:GeneralUtils.java

示例7: SmartViewHolder

import android.view.View; //导入方法依赖的package包/类
public SmartViewHolder(View itemView, AdapterView.OnItemClickListener mListener) {
    super(itemView);

    /**
     * 设置水波纹背景
     */
    if (itemView.getBackground() == null) {
        TypedValue typedValue = new TypedValue();
        Resources.Theme theme = itemView.getContext().getTheme();
        int top = itemView.getPaddingTop();
        int bottom = itemView.getPaddingBottom();
        int left = itemView.getPaddingLeft();
        int right = itemView.getPaddingRight();
        if (theme.resolveAttribute(android.R.attr.selectableItemBackground, typedValue, true)) {
            itemView.setBackgroundResource(typedValue.resourceId);
        }
        itemView.setPadding(left, top, right, bottom);
    }
}
 
开发者ID:qianxinyi,项目名称:DripUltraRefreshWithLoad,代码行数:20,代码来源:SmartViewHolder.java

示例8: setBackgroundKeepingPadding

import android.view.View; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
public static void setBackgroundKeepingPadding(View view, Drawable drawable) {
    int[] padding = new int[]{view.getPaddingLeft(), view.getPaddingTop(), view.getPaddingRight(), view.getPaddingBottom()};
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
        view.setBackground(drawable);
    } else {
        view.setBackgroundDrawable(drawable);
    }
    view.setPadding(padding[0], padding[1], padding[2], padding[3]);
}
 
开发者ID:QMUI,项目名称:QMUI_Android,代码行数:12,代码来源:QMUIViewHelper.java

示例9: getActivityLaunchOptions

import android.view.View; //导入方法依赖的package包/类
private Bundle getActivityLaunchOptions(View v) {
    if (Utilities.ATLEAST_MARSHMALLOW) {
        int left = 0, top = 0;
        int width = v.getMeasuredWidth(), height = v.getMeasuredHeight();
        if (v instanceof TextView) {
            // Launch from center of icon, not entire view
            Drawable icon = Workspace.getTextViewIcon((TextView) v);
            if (icon != null) {
                Rect bounds = icon.getBounds();
                left = (width - bounds.width()) / 2;
                top = v.getPaddingTop();
                width = bounds.width();
                height = bounds.height();
            }
        }
        return ActivityOptions.makeClipRevealAnimation(v, left, top, width, height).toBundle();
    } else if (Utilities.ATLEAST_LOLLIPOP_MR1) {
        // On L devices, we use the device default slide-up transition.
        // On L MR1 devices, we use a custom version of the slide-up transition which
        // doesn't have the delay present in the device default.
        return ActivityOptions.makeCustomAnimation(
                this, R.anim.task_open_enter, R.anim.no_anim).toBundle();
    }
    return null;
}
 
开发者ID:michelelacorte,项目名称:FlickLauncher,代码行数:26,代码来源:Launcher.java

示例10: resetViewBottomPadding

import android.view.View; //导入方法依赖的package包/类
public static void resetViewBottomPadding(@Nullable View view, boolean scroll) {
    if (view == null) return;

    Context context = ContextHelper.getBaseContext(view);
    int orientation = context.getResources().getConfiguration().orientation;

    int left = view.getPaddingLeft();
    int right = view.getPaddingRight();
    int bottom = view.getPaddingTop();
    int top = view.getPaddingTop();
    int navBar = 0;

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        boolean tabletMode = context.getResources().getBoolean(R.bool.android_helpers_tablet_mode);
        if (tabletMode || orientation == Configuration.ORIENTATION_PORTRAIT) {
            navBar = getNavigationBarHeight(context);
        }

        if (!scroll) {
            navBar += getStatusBarHeight(context);
        }
    }

    if (!scroll) {
        navBar += getToolbarHeight(context);
    }
    view.setPadding(left, top, right, (bottom + navBar));
}
 
开发者ID:danimahardhika,项目名称:wallpaperboard,代码行数:29,代码来源:ViewHelper.java

示例11: showMoreKeysPanel

import android.view.View; //导入方法依赖的package包/类
@Override
public void showMoreKeysPanel(final View parentView, final Controller controller,
        final int pointX, final int pointY, final KeyboardActionListener listener) {
    mController = controller;
    mListener = listener;
    final View container = getContainerView();
    // The coordinates of panel's left-top corner in parentView's coordinate system.
    // We need to consider background drawable paddings.
    final int x = pointX - getDefaultCoordX() - container.getPaddingLeft() - getPaddingLeft();
    final int y = pointY - container.getMeasuredHeight() + container.getPaddingBottom()
            + getPaddingBottom();

    parentView.getLocationInWindow(mCoordinates);
    // Ensure the horizontal position of the panel does not extend past the parentView edges.
    final int maxX = parentView.getMeasuredWidth() - container.getMeasuredWidth();
    final int panelX = Math.max(0, Math.min(maxX, x)) + CoordinateUtils.x(mCoordinates);
    final int panelY = y + CoordinateUtils.y(mCoordinates);
    container.setX(panelX);
    container.setY(panelY);

    mOriginX = x + container.getPaddingLeft();
    mOriginY = y + container.getPaddingTop();
    controller.onShowMoreKeysPanel(this);
    final MoreKeysKeyboardAccessibilityDelegate accessibilityDelegate = mAccessibilityDelegate;
    if (accessibilityDelegate != null
            && AccessibilityUtils.getInstance().isAccessibilityEnabled()) {
        accessibilityDelegate.onShowMoreKeysKeyboard();
    }
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:30,代码来源:MoreKeysKeyboardView.java

示例12: getPadding

import android.view.View; //导入方法依赖的package包/类
@Override
public final int getPadding(@NonNull final Axis axis, final int gravity,
                            @NonNull final View view) {
    ensureNotNull(axis, "The axis may not be null");
    ensureTrue(gravity == Gravity.START || gravity == Gravity.END, "Invalid gravity");
    ensureNotNull(view, "The view may not be null");

    if (getOrientationInvariantAxis(axis) == Axis.DRAGGING_AXIS) {
        return gravity == Gravity.START ? view.getPaddingTop() : view.getPaddingBottom();
    } else {
        return gravity == Gravity.START ? view.getPaddingLeft() : view.getPaddingRight();
    }
}
 
开发者ID:NeoTerm,项目名称:NeoTerm,代码行数:14,代码来源:PhoneArithmetics.java

示例13: prepare

import android.view.View; //导入方法依赖的package包/类
@Override
public void prepare(View target) {
    float x = target.getPaddingLeft();
    float y = target.getPaddingTop();
    getAnimatorAgent().playTogether(
            Glider.glide(Skill.SineEaseInOut, 1300, ObjectAnimator.ofFloat(target, "rotation", 0, 80, 60, 80, 60, 60)),
            ObjectAnimator.ofFloat(target, "translationY", 0, 0, 0, 0, 0, 700),
            ObjectAnimator.ofFloat(target, "alpha", 1, 1, 1, 1, 1, 0),
            ObjectAnimator.ofFloat(target, "pivotX", x, x, x, x, x, x),
            ObjectAnimator.ofFloat(target, "pivotY", y, y, y, y, y, y)
    );

    setDuration(1300);
}
 
开发者ID:devzwy,项目名称:KUtils,代码行数:15,代码来源:HingeAnimator.java

示例14: onTouch

import android.view.View; //导入方法依赖的package包/类
@Override
public boolean onTouch(final View v, final MotionEvent event) {
    if (event.getAction() == MotionEvent.ACTION_DOWN && drawable != null) {
        final int x = (int) event.getX();
        final int y = (int) event.getY();
        final Rect bounds = drawable.getBounds();
        if (x >= (v.getRight() - bounds.width() - fuzz) && x <= (v.getRight() - v.getPaddingRight() + fuzz)
                && y >= (v.getPaddingTop() - fuzz) && y <= (v.getHeight() - v.getPaddingBottom()) + fuzz) {
            return onDrawableTouch(event);
        }
    }
    return false;
}
 
开发者ID:mityung,项目名称:XERUNG,代码行数:14,代码来源:VerifyOTP.java

示例15: setGeometry

import android.view.View; //导入方法依赖的package包/类
public void setGeometry(final View previewTextView) {
    final int previewWidth = previewTextView.getMeasuredWidth();
    final int previewHeight = mPreviewHeight;
    // The width and height of visible part of the key preview background. The content marker
    // of the background 9-patch have to cover the visible part of the background.
    mVisibleWidth = previewWidth - previewTextView.getPaddingLeft()
            - previewTextView.getPaddingRight();
    mVisibleHeight = previewHeight - previewTextView.getPaddingTop()
            - previewTextView.getPaddingBottom();
    // The distance between the top edge of the parent key and the bottom of the visible part
    // of the key preview background.
    setVisibleOffset(mPreviewOffset - previewTextView.getPaddingBottom());
}
 
开发者ID:sergeychilingaryan,项目名称:AOSP-Kayboard-7.1.2,代码行数:14,代码来源:KeyPreviewDrawParams.java


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