當前位置: 首頁>>代碼示例>>Java>>正文


Java View.getPaddingLeft方法代碼示例

本文整理匯總了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);
}
 
開發者ID:rkkr,項目名稱:simple-keyboard,代碼行數:25,代碼來源:MoreKeysKeyboardView.java

示例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);
    }
}
 
開發者ID:qianxinyi,項目名稱:DripUltraRefreshWithLoad,代碼行數:20,代碼來源:SmartViewHolder.java

示例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;
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:12,代碼來源:AnimationBuilder.java

示例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);
    }
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:32,代碼來源:GridItemDecoration.java

示例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);
    }
}
 
開發者ID:milosmns,項目名稱:silly-android,代碼行數:16,代碼來源:SillyAndroid.java

示例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)
    );
}
 
開發者ID:weileng11,項目名稱:KUtils-master,代碼行數:12,代碼來源:RotateOutUpLeftAnimator.java

示例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;
    }
}
 
開發者ID:mzlogin,項目名稱:guanggoo-android,代碼行數:15,代碼來源:MyHtmlHttpImageGetter.java

示例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);
}
 
開發者ID:weileng11,項目名稱:KUtils-master,代碼行數:15,代碼來源:HingeAnimator.java

示例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)
    );
}
 
開發者ID:weileng11,項目名稱:KUtils-master,代碼行數:12,代碼來源:RotateOutDownLeftAnimator.java

示例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)
    );
}
 
開發者ID:alibaba,項目名稱:LuaViewPlayground,代碼行數:12,代碼來源:WaveAnimatorDecoration.java

示例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());
}
 
開發者ID:sergeychilingaryan,項目名稱:AOSP-Kayboard-7.1.2,代碼行數:14,代碼來源:KeyPreviewDrawParams.java

示例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);
		}
	}
}
 
開發者ID:liuyanggithub,項目名稱:SuperSelector,代碼行數:29,代碼來源:Util.java

示例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);
}
 
開發者ID:rkshuai,項目名稱:chromium-for-android-56-debug-video,代碼行數:14,代碼來源:ViewUtils.java

示例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();
    }
}
 
開發者ID:lizhangqu,項目名稱:chromium-net-for-android,代碼行數:12,代碼來源:ApiCompatibilityUtils.java

示例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;
}
 
開發者ID:junchenChow,項目名稱:exciting-app,代碼行數:15,代碼來源:AnimationBuilder.java


注:本文中的android.view.View.getPaddingLeft方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。