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


Java Px類代碼示例

本文整理匯總了Java中android.support.annotation.Px的典型用法代碼示例。如果您正苦於以下問題:Java Px類的具體用法?Java Px怎麽用?Java Px使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Px類屬於android.support.annotation包,在下文中一共展示了Px類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onLayout

import android.support.annotation.Px; //導入依賴的package包/類
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
  View view = resolveView();
  if (view != null) {
    int width = getMeasuredWidth();
    int height = getMeasuredHeight();
    @Px int leftLineWidth = leftBorder == BorderMode.LINE ?
        1 : leftPageBorder.getIntrinsicWidth();
    @Px int rightLineWidth = rightBorder == BorderMode.HIDDEN ?
        0 : rightPageBorder.getIntrinsicWidth();
    int headerFooterHeight = 0;
    view.layout(leftLineWidth, headerFooterHeight,
        width - rightLineWidth, height - headerFooterHeight);
    super.onLayout(changed, l, t, r, b);
  }
}
 
開發者ID:Elias33,項目名稱:Quran,代碼行數:17,代碼來源:QuranPageLayout.java

示例2: scrollTo

import android.support.annotation.Px; //導入依賴的package包/類
@Override
public void scrollTo(@Px int x, @Px int y) {
    if (y < mMinPosition) {
        goStartEdgeEffect(y);
        y = mMinPosition;
    }
    if (y > mMaxPosition) {
        goEndEdgeEffect(y);
        y = mMaxPosition;
    }
    if (y != getScrollY()) {
        super.scrollTo(x, y);
    }

    mCurrentScale = scrollYtoScale(y);
    if (mRulerCallback != null) {
        mRulerCallback.onScaleChanging(Math.round(mCurrentScale));
    }

}
 
開發者ID:totond,項目名稱:BooheeRuler,代碼行數:21,代碼來源:VerticalRuler.java

示例3: scrollTo

import android.support.annotation.Px; //導入依賴的package包/類
@Override
public void scrollTo(@Px int x, @Px int y) {
    if (x < mMinPosition) {
        goStartEdgeEffect(x);
        x = mMinPosition;
    }
    if (x > mMaxPosition) {
        goEndEdgeEffect(x);
        x = mMaxPosition;
    }
    if (x != getScrollX()) {
        super.scrollTo(x, y);
    }

    mCurrentScale = scrollXtoScale(x);
    if (mRulerCallback != null) {
        mRulerCallback.onScaleChanging(Math.round(mCurrentScale));
    }

}
 
開發者ID:totond,項目名稱:BooheeRuler,代碼行數:21,代碼來源:HorizontalRuler.java

示例4: resize

import android.support.annotation.Px; //導入依賴的package包/類
/**
 * Resize the image to the specified size in pixels.
 * Use 0 as desired dimension to resize keeping aspect ratio.
 */
public Builder resize(@Px int targetWidth, @Px int targetHeight) {
  if (targetWidth < 0) {
    throw new IllegalArgumentException("Width must be positive number or 0.");
  }
  if (targetHeight < 0) {
    throw new IllegalArgumentException("Height must be positive number or 0.");
  }
  if (targetHeight == 0 && targetWidth == 0) {
    throw new IllegalArgumentException("At least one dimension has to be positive number.");
  }
  this.targetWidth = targetWidth;
  this.targetHeight = targetHeight;
  return this;
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:19,代碼來源:Request.java

示例5: setProgressRadius

import android.support.annotation.Px; //導入依賴的package包/類
/**
 * Sets the radius of the progress arc.
 *
 * @param radius The desired radius.
 * @see #getProgressRadius()
 */
public void setProgressRadius(@Px int radius) {
	if (mProgressRadius != radius) {
		this.mProgressRadius = radius;
		this.handleDrawablesSizeChange();
	}
}
 
開發者ID:universum-studios,項目名稱:android_ui,代碼行數:13,代碼來源:RefreshDrawable.java

示例6: setInitialElevationPx

import android.support.annotation.Px; //導入依賴的package包/類
/**
 * @param value The elevation (in px) with which the toolbar starts
 * @return Own object
 */
public WaterfallToolbar setInitialElevationPx(@Px @NonNull final Integer value) {
    mInitialElevation = value;

    // gotta update elevation in case this value have
    // been set in a running and visible activity
    if (mIsSetup) adjustCardElevation();

    return this;
}
 
開發者ID:HugoCastelani,項目名稱:waterfall-toolbar,代碼行數:14,代碼來源:WaterfallToolbar.java

示例7: setFinalElevationPx

import android.support.annotation.Px; //導入依賴的package包/類
/**
 * @param value The elevation (in px) the toolbar gets when it reaches final scroll elevation
 * @return Own object
 */
public WaterfallToolbar setFinalElevationPx(@Px @NonNull final Integer value) {
    mFinalElevation = value;

    // gotta update elevation in case this value have
    // been set in a running and visible activity
    if (mIsSetup) adjustCardElevation();

    return this;
}
 
開發者ID:HugoCastelani,項目名稱:waterfall-toolbar,代碼行數:14,代碼來源:WaterfallToolbar.java

示例8: setPaddingVertical

import android.support.annotation.Px; //導入依賴的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

示例9: setPaddingHorizontal

import android.support.annotation.Px; //導入依賴的package包/類
/**
 * Sets the left/start and right/end padding to the given View, keeping the vertical padding values as the were.
 *
 * @param view    Which view to set the padding to, must not be {@code null}
 * @param padding The horizontal padding value
 */
public static void setPaddingHorizontal(@NonNull final View view, @Px final int padding) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        view.setPaddingRelative(padding, view.getPaddingTop(), padding, view.getPaddingBottom());
    } else {
        view.setPadding(padding, view.getPaddingTop(), padding, view.getPaddingBottom());
    }
}
 
開發者ID:milosmns,項目名稱:silly-android,代碼行數:14,代碼來源:SillyAndroid.java

示例10: drawableToBitmap

import android.support.annotation.Px; //導入依賴的package包/類
/**
 * Converts a {@link Drawable} into a {@link Bitmap}. Includes an optimization in case the {@link Drawable} in question is already a
 * {@link BitmapDrawable}.
 *
 * @param drawable A Drawable instance to convert
 * @param width    The width of the new Bitmap
 * @param height   The height of the new Bitmap
 * @return A new {@link Bitmap} instance constraint to width and height dimensions supplied, never {@code null}
 */
@NonNull
@SuppressWarnings("unused")
public static Bitmap drawableToBitmap(@NonNull final Drawable drawable, @Px final int width, @Px final int height) {
    final Bitmap result = Bitmap.createBitmap(width, height, Bitmap.Config.ARGB_8888);
    final Canvas canvas = new Canvas(result);
    drawable.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
    drawable.draw(canvas);
    return result;
}
 
開發者ID:milosmns,項目名稱:silly-android,代碼行數:19,代碼來源:SillyAndroid.java

示例11: setPadding

import android.support.annotation.Px; //導入依賴的package包/類
@Override
public void setPadding(@Px int left, @Px int top, @Px int right, @Px int bottom) {
    if (mPager != null) {
        mPager.setPadding(left, top, right, bottom);
    } else {
        // Pass to ourselves. We will remove it in the constructor.
        super.setPadding(left, top, right, bottom);
    }
}
 
開發者ID:natario1,項目名稱:ViewPrinter,代碼行數:10,代碼來源:DocumentView.java

示例12: setPadding

import android.support.annotation.Px; //導入依賴的package包/類
@Override
public void setPadding(@Px int left, @Px int top, @Px int right, @Px int bottom) {
	left += mShadowRadius;
	top += mShadowRadius;
	right += mShadowRadius;
	bottom += mShadowRadius;
	super.setPadding(left, top, right, bottom);
}
 
開發者ID:kyleduo,項目名稱:BlurPopupWindow,代碼行數:9,代碼來源:ShadowContainer.java

示例13: scrollTo

import android.support.annotation.Px; //導入依賴的package包/類
@Override
public void scrollTo(@Px int x, @Px int y) {
    int offset = Math.min(maxScrollY, edgeScroll ? y : Math.max(0, y));
    boolean layout = false;
    if (getScrollY() != offset) {
        layout = true;
    }
    super.scrollTo(0, offset);
    if (layout) {
        requestLayout();
    }
    if (mOnScrollListener != null) {
        mOnScrollListener.onScrollTo(offset);
    }
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:16,代碼來源:StickLayout2.java

示例14: scrollTo

import android.support.annotation.Px; //導入依賴的package包/類
@Override
public void scrollTo(@Px int x, @Px int y) {
    int offset = Math.min(maxScrollY, Math.max(0, y));
    boolean layout = false;
    if (getScrollY() != offset) {
        layout = true;
    }
    super.scrollTo(0, offset);
    if (layout) {
        requestLayout();
    }
    if (mOnScrollListener != null) {
        mOnScrollListener.onScrollTo(offset);
    }
}
 
開發者ID:angcyo,項目名稱:RLibrary,代碼行數:16,代碼來源:StickLayout.java

示例15: getDimension

import android.support.annotation.Px; //導入依賴的package包/類
@Px
static int getDimension(Context context,
                        TypedArray array,
                        @StyleableRes int attr,
                        @DimenRes int defaultDimenRes) {

    return array.getDimensionPixelOffset(
            attr, context.getResources().getDimensionPixelSize(defaultDimenRes));
}
 
開發者ID:dewarder,項目名稱:CameraButton,代碼行數:10,代碼來源:TypedArrayHelper.java


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