本文整理汇总了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);
}
示例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);
}
示例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;
}
}
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
}
示例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]);
}
示例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;
}
示例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));
}
示例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();
}
}
示例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();
}
}
示例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);
}
示例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;
}
示例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());
}