本文整理汇总了Java中android.view.View.getPaddingRight方法的典型用法代码示例。如果您正苦于以下问题:Java View.getPaddingRight方法的具体用法?Java View.getPaddingRight怎么用?Java View.getPaddingRight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.getPaddingRight方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: drawVertical
import android.view.View; //导入方法依赖的package包/类
public void drawVertical(Canvas c, RecyclerView parent) {
final int childCount = parent.getChildCount();
// 在每一个子控件的右侧画线
for (int i = 0; i < childCount; i++) {
final View child = parent.getChildAt(i);
int right = child.getRight() - child.getPaddingRight();
int left = right - mDivider.getIntrinsicWidth();
final int top = child.getTop() + child.getPaddingTop();
final int bottom = child.getTop() + child.getHeight() - child.getPaddingBottom();
mDivider.setBounds(left, top, right, bottom);
mDivider.draw(c);
}
}
示例3: SmartViewHolder
import android.view.View; //导入方法依赖的package包/类
public SmartViewHolder(View itemView, AdapterView.OnItemClickListener mListener) {
super(itemView);
this.mListener = mListener;
itemView.setOnClickListener(this);
/**
* 设置水波纹背景
*/
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);
}
}
示例4: from
import android.view.View; //导入方法依赖的package包/类
public static WaitViewController from(View view) {
if (view instanceof WaitView) {
return ((WaitView) view).getController();
}
int width = view.getWidth();
int height = view.getHeight();
if (width == 0) {
int spec = View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED);
view.measure(spec, spec);
width = view.getMeasuredWidth();
height = view.getMeasuredHeight();
}
RectF drawRect = new RectF(0, 0, width-view.getPaddingLeft()-view.getPaddingRight(), height-view.getPaddingTop()-view.getPaddingBottom());
WaitViewController controller = (WaitViewController) view.getTag(R.id.ta_waitview);
if (controller == null) {
controller = new WaitViewController(view, drawRect);
view.setTag(R.id.ta_waitview, controller);
}
return controller;
}
示例5: prepare
import android.view.View; //导入方法依赖的package包/类
@Override
public void prepare(View target) {
float x = target.getWidth() - target.getPaddingRight();
float y = target.getHeight() - target.getPaddingBottom();
getAnimatorAgent().playTogether(
ObjectAnimator.ofFloat(target, "alpha", 1, 0),
ObjectAnimator.ofFloat(target, "rotation", 0, 90),
ObjectAnimator.ofFloat(target, "pivotX", x, x),
ObjectAnimator.ofFloat(target, "pivotY", y, y)
);
}
示例6: prepare
import android.view.View; //导入方法依赖的package包/类
@Override
public void prepare(View target) {
float x = (target.getWidth() - target.getPaddingLeft() - target.getPaddingRight()) / 2
+ target.getPaddingLeft();
float y = target.getHeight() - target.getPaddingBottom();
getAnimatorAgent().playTogether(
ObjectAnimator.ofFloat(target, "rotation", 12, -12, 3, -3, 0),
ObjectAnimator.ofFloat(target, "pivotX", x, x, x, x, x),
ObjectAnimator.ofFloat(target, "pivotY", y, y, y, y, y)
);
}
示例7: setBackgroundDrawable
import android.view.View; //导入方法依赖的package包/类
protected static void setBackgroundDrawable(View view, Drawable drawable)
{
if (view == null)
{
return;
}
int paddingLeft = view.getPaddingLeft();
int paddingTop = view.getPaddingTop();
int paddingRight = view.getPaddingRight();
int paddingBottom = view.getPaddingBottom();
view.setBackgroundDrawable(drawable);
view.setPadding(paddingLeft, paddingTop, paddingRight, paddingBottom);
}
示例8: 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));
}
示例9: 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;
}
示例10: 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();
}
}
示例11: prepare
import android.view.View; //导入方法依赖的package包/类
@Override
protected void prepare(AnimatorSet animatorSet, View target) {
float x = (target.getWidth() - target.getPaddingLeft() - target.getPaddingRight()) / 2
+ target.getPaddingLeft();
float y = target.getHeight() - target.getPaddingBottom();
animatorSet.playTogether(
ObjectAnimator.ofFloat(target, "pivotX", x, x, x, x, x),
ObjectAnimator.ofFloat(target, "pivotY", y, y, y, y, y),
ObjectAnimator.ofFloat(target, "rotationX", 55, -30, 15, -15, 0)
);
}
示例12: prepare
import android.view.View; //导入方法依赖的package包/类
@Override
protected void prepare(AnimatorSet animatorSet, View target) {
float x = target.getWidth() - target.getPaddingRight();
float y = target.getHeight() - target.getPaddingBottom();
animatorSet.playTogether(
ObjectAnimator.ofFloat(target, "rotation", -90, 0),
ObjectAnimator.ofFloat(target, "alpha", 0, 1),
ObjectAnimator.ofFloat(target, "pivotX", x, x),
ObjectAnimator.ofFloat(target, "pivotY", y, y)
);
}
示例13: onBindView
import android.view.View; //导入方法依赖的package包/类
@Override
protected void onBindView(View view) {
super.onBindView(view);
if (mDrawDivider) {
int left = view.getPaddingLeft();
int right = view.getPaddingRight();
int top = view.getPaddingTop();
int bottom = view.getPaddingBottom();
view.setBackground(DividerDrawable.create(getContext()));
view.setPadding(left, top, right, bottom);
}
SwitchCompat switchView = (SwitchCompat) view.findViewById(R.id.switch_widget);
// On BLU Life Play devices SwitchPreference.setWidgetLayoutResource() does nothing. As a
// result, the user will see a non-material Switch and switchView will be null, hence the
// null check below. http://crbug.com/451447
if (switchView != null) {
switchView.setChecked(isChecked());
}
TextView title = (TextView) view.findViewById(android.R.id.title);
title.setSingleLine(false);
if (!mDontUseSummaryAsTitle && TextUtils.isEmpty(getTitle())) {
TextView summary = (TextView) view.findViewById(android.R.id.summary);
title.setText(summary.getText());
title.setVisibility(View.VISIBLE);
summary.setVisibility(View.GONE);
}
if (mManagedPrefDelegate != null) mManagedPrefDelegate.onBindViewToPreference(this, view);
}
示例14: prepare
import android.view.View; //导入方法依赖的package包/类
@Override
public void prepare(View target) {
float x = target.getWidth() - target.getPaddingRight();
float y = target.getHeight() - target.getPaddingBottom();
getAnimatorAgent().playTogether(
ObjectAnimator.ofFloat(target, "alpha", 1, 0),
ObjectAnimator.ofFloat(target, "rotation", 0, -90),
ObjectAnimator.ofFloat(target, "pivotX", x, x),
ObjectAnimator.ofFloat(target, "pivotY", y, y)
);
}
示例15: setPaddingVertical
import android.view.View; //导入方法依赖的package包/类
/**
* Sets the top and bottom padding to the given View, keeping the horizontal padding values as the were.
*
* @param view Which view to set the padding to, must not be {@code null}
* @param padding The vertical padding value
*/
public static void setPaddingVertical(@NonNull final View view, @Px final int padding) {
final int paddingStart = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 ? view.getPaddingStart() : view.getPaddingLeft();
final int paddingEnd = Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1 ? view.getPaddingEnd() : view.getPaddingRight();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
view.setPaddingRelative(paddingStart, padding, paddingEnd, padding);
} else {
view.setPadding(paddingStart, padding, paddingEnd, padding);
}
}