本文整理汇总了Java中android.view.View.getPaddingLeft方法的典型用法代码示例。如果您正苦于以下问题:Java View.getPaddingLeft方法的具体用法?Java View.getPaddingLeft怎么用?Java View.getPaddingLeft使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.View
的用法示例。
在下文中一共展示了View.getPaddingLeft方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: 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);
}
}
示例3: standUp
import android.view.View; //导入方法依赖的package包/类
public AnimationBuilder standUp() {
for (View view : this.views) {
float x = (float) ((((view.getWidth() - view.getPaddingLeft()) - view.getPaddingRight
()) / 2) + view.getPaddingLeft());
float y = (float) (view.getHeight() - view.getPaddingBottom());
pivotX(x, x, x, x, x);
pivotY(y, y, y, y, y);
rotationX(55.0f, -30.0f, 15.0f, -15.0f, 0.0f);
}
return this;
}
示例4: onDrawOver
import android.view.View; //导入方法依赖的package包/类
/**
* @param c
* @param parent
* @param state
*/
@Override
public void onDrawOver(Canvas c, RecyclerView parent, RecyclerView.State state) {
if (dividerDrawable == null) {
return;
}
int childCount = parent.getChildCount();
int rightV = parent.getWidth();
for (int i = 0; i < childCount; i++) {
View child = parent.getChildAt(i);
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
int leftV = parent.getPaddingLeft() + child.getPaddingLeft();
int bottomV = child.getTop() - params.topMargin;
int topV = bottomV - dividerDrawable.getIntrinsicHeight();
int topH = child.getTop() + params.topMargin;
int bottomH = child.getBottom() + params.bottomMargin;
int rightH = child.getLeft() - params.leftMargin;
int leftH = rightH - dividerDrawable.getIntrinsicWidth();
dividerDrawable.setBounds(leftH, topH, rightH, bottomH);
dividerDrawable.draw(c);
dividerDrawable.setBounds(leftV, topV, rightV, bottomV);
dividerDrawable.draw(c);
}
}
示例5: 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);
}
}
示例6: prepare
import android.view.View; //导入方法依赖的package包/类
@Override
public void prepare(View target) {
float x = target.getPaddingLeft();
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)
);
}
示例7: getScale
import android.view.View; //导入方法依赖的package包/类
private float getScale(float originalDrawableWidth) {
View container = containerReference.get();
if (container == null) {
return 1f;
}
float maxWidth = container.getWidth() - container.getPaddingLeft() - container.getPaddingRight();
if (matchParentWidth) {
return maxWidth / originalDrawableWidth;
} else {
return Math.min(maxWidth, originalDrawableWidth) / originalDrawableWidth;
}
}
示例8: 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);
}
示例9: prepare
import android.view.View; //导入方法依赖的package包/类
@Override
public void prepare(View target) {
float x = target.getPaddingLeft();
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)
);
}
示例10: 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, "rotation", 12, -12, 3, -3, 0),
ObjectAnimator.ofFloat(target, "pivotX", x, x, x, x, x),
ObjectAnimator.ofFloat(target, "pivotY", y, y, y, y, y)
);
}
示例11: 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());
}
示例12: setItemStyle
import android.view.View; //导入方法依赖的package包/类
public static void setItemStyle(View[] viewArray, int[] bgRes, boolean keepPadding) {
List<View> layout = new ArrayList<View>();
for (int i = 0; i < viewArray.length; i++) {
View v = viewArray[i];
if (v.getVisibility() == View.VISIBLE) {
layout.add(v);
}
}
for (int i = 0, count = layout.size(); i < count; i++) {
View view = layout.get(i);
int l = view.getPaddingLeft();
int t = view.getPaddingTop();
int r = view.getPaddingRight();
int b = view.getPaddingBottom();
if (count == 1) {
view.setBackgroundResource(bgRes[0]);
} else if (count >= 2 && i == 0) {
view.setBackgroundResource(bgRes[1]);
} else if (count >= 2 && i == (count - 1)) {
view.setBackgroundResource(bgRes[3]);
} else {
view.setBackgroundResource(bgRes[2]);
}
if (keepPadding) {
view.setPadding(l, t, r, b);
}
}
}
示例13: setNinePatchBackgroundResource
import android.view.View; //导入方法依赖的package包/类
/**
* Sets the background of a view to the given 9-patch resource and restores its padding. This
* works around a bug in Android where the padding is lost when a 9-patch resource is applied
* programmatically.
*/
public static void setNinePatchBackgroundResource(View view, @DrawableRes int resource) {
int left = view.getPaddingLeft();
int top = view.getPaddingTop();
int right = view.getPaddingRight();
int bottom = view.getPaddingBottom();
view.setBackgroundResource(resource);
view.setPadding(left, top, right, bottom);
}
示例14: getPaddingStart
import android.view.View; //导入方法依赖的package包/类
/**
* @see android.view.View#getPaddingStart()
*/
public static int getPaddingStart(View view) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
return view.getPaddingStart();
} else {
// Before JB MR1, all layouts are left-to-right, so start == left.
return view.getPaddingLeft();
}
}
示例15: standUp
import android.view.View; //导入方法依赖的package包/类
/**
* @return the animation builder
*/
public AnimationBuilder standUp() {
for (View view : views) {
float x = (view.getWidth() - view.getPaddingLeft() - view.getPaddingRight()) / 2
+ view.getPaddingLeft();
float y = view.getHeight() - view.getPaddingBottom();
pivotX(x, x, x, x, x);
pivotY(y, y, y, y, y);
rotationX(55, -30, 15, -15, 0);
}
return this;
}