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


Java DimenRes類代碼示例

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


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

示例1: getEmoji

import android.support.annotation.DimenRes; //導入依賴的package包/類
private static Bitmap getEmoji(
        Context context, String emoji, @DimenRes int sizeResId, @DimenRes int insetResId) {
    if (context == null || TextUtils.isEmpty(emoji)) {
        return null;
    }
    int size = context.getResources().getDimensionPixelSize(sizeResId);
    int inset = context.getResources().getDimensionPixelSize(insetResId);
    Paint paint = new Paint(Paint.ANTI_ALIAS_FLAG);
    paint.setStyle(Paint.Style.FILL);
    paint.setTextAlign(Paint.Align.LEFT);
    paint.setTextSize(size);
    float baseline = -paint.ascent();
    int width = (int) (paint.measureText(emoji) + 0.5f);
    int height = (int) (baseline + paint.descent() + 0.5f);
    Bitmap bitmap = Bitmap.createBitmap(width + inset * 2, height + inset * 2, Bitmap.Config.ARGB_8888);
    Canvas canvas = new Canvas(bitmap);
    canvas.drawText(emoji, inset, baseline + inset, paint);
    return bitmap;
}
 
開發者ID:nicholasrout,項目名稱:shortstories,代碼行數:20,代碼來源:BitmapUtil.java

示例2: create

import android.support.annotation.DimenRes; //導入依賴的package包/類
public static CharacterDrawable create(Context context, char character, boolean roundAsCircle, @DimenRes int padding) {
    return new CharacterDrawable.Builder()
            .setCharacter(character)
            .setBackgroundRoundAsCircle(roundAsCircle)
            .setCharacterPadding(context.getResources().getDimensionPixelSize(padding))
            .build();
}
 
開發者ID:xxczaki,項目名稱:music-player,代碼行數:8,代碼來源:CharacterDrawable.java

示例3: setShadowsHeightDimens

import android.support.annotation.DimenRes; //導入依賴的package包/類
public void setShadowsHeightDimens(@DimenRes int left, @DimenRes int top, @DimenRes int right, @DimenRes int bottom) {
    mShadowLeftHeight = mResources.getDimensionPixelOffset(left);
    mShadowTopHeight = mResources.getDimensionPixelOffset(top);
    mShadowRightHeight = mResources.getDimensionPixelOffset(right);
    mShadowBottomHeight = mResources.getDimensionPixelOffset(bottom);
    invalidate();
}
 
開發者ID:R12rus,項目名稱:ShadowFrameLayout,代碼行數:8,代碼來源:ShadowFrameLayout.java

示例4: getDimension

import android.support.annotation.DimenRes; //導入依賴的package包/類
@Override
public float getDimension(@DimenRes int id) throws NotFoundException {
    int realId = getCorrespondResId(id);
    if (realId > 0) {
        return mSkinResources.getDimension(realId);
    }
    return super.getDimension(id);
}
 
開發者ID:Zeal27,項目名稱:SkinFramework,代碼行數:9,代碼來源:ComposedResources.java

示例5: getDimensionPixelSize

import android.support.annotation.DimenRes; //導入依賴的package包/類
@Override
public int getDimensionPixelSize(@DimenRes int id) throws NotFoundException {
    int realId = getCorrespondResId(id);
    if (realId > 0) {
        return mSkinResources.getDimensionPixelSize(realId);
    }
    return super.getDimensionPixelSize(id);
}
 
開發者ID:Zeal27,項目名稱:SkinFramework,代碼行數:9,代碼來源:ComposedResources.java

示例6: margin

import android.support.annotation.DimenRes; //導入依賴的package包/類
public Builder margin(@DimenRes int commonMargin) {
    margin.add(commonMargin);
    margin.add(commonMargin);
    margin.add(commonMargin);
    margin.add(commonMargin);
    return this;
}
 
開發者ID:Mindjet,項目名稱:LiteReader,代碼行數:8,代碼來源:ButtonViewModel.java

示例7: setAvatarSize

import android.support.annotation.DimenRes; //導入依賴的package包/類
private void setAvatarSize(@DimenRes int res) {
	LayoutParams params = (LayoutParams) avatar.getLayoutParams();
	int size = getResources().getDimensionPixelSize(res);
	params.height = size;
	params.width = size;
	avatar.setLayoutParams(params);
}
 
開發者ID:rafjordao,項目名稱:Nird2,代碼行數:8,代碼來源:AuthorView.java

示例8: setContainerPadding

import android.support.annotation.DimenRes; //導入依賴的package包/類
/**
 * Set {@code start}, {@code top}, {@code end} and {@code bottom} padding for zooming and scrolling area using dimension.
 *
 * @return This Builder object to allow for chaining of calls to set methods
 */
public Builder setContainerPadding(Context context,
                                   @DimenRes int start, @DimenRes int top,
                                   @DimenRes int end, @DimenRes int bottom) {
    setContainerPaddingPx(
            Math.round(context.getResources().getDimension(start)),
            Math.round(context.getResources().getDimension(top)),
            Math.round(context.getResources().getDimension(end)),
            Math.round(context.getResources().getDimension(bottom))
    );
    return this;
}
 
開發者ID:achenglike,項目名稱:imageviewer,代碼行數:17,代碼來源:ImageViewer.java

示例9: setDialogRadius

import android.support.annotation.DimenRes; //導入依賴的package包/類
public Builder setDialogRadius(@DimenRes int dialogRadiusDimen) {
    this.dialogRadius = context.getResources().getDimensionPixelSize(dialogRadiusDimen);
    return this;
}
 
開發者ID:appwise-labs,項目名稱:NoInternetDialog,代碼行數:5,代碼來源:NoInternetDialog.java

示例10: sizeResId

import android.support.annotation.DimenRes; //導入依賴的package包/類
public T sizeResId(@DimenRes int sizeId) {
    return size(mResources.getDimensionPixelSize(sizeId));
}
 
開發者ID:weiwenqiang,項目名稱:GitHub,代碼行數:4,代碼來源:FlexibleDividerDecoration.java

示例11: setErrorTextSizeResource

import android.support.annotation.DimenRes; //導入依賴的package包/類
public Builder setErrorTextSizeResource(@DimenRes int mErrorTextSizeRes) {
    return setErrorTextSize(getDimensionPixelSize(mErrorTextSizeRes));
}
 
開發者ID:AriesHoo,項目名稱:FastLib,代碼行數:4,代碼來源:FastMultiStatusView.java

示例12: marginResId

import android.support.annotation.DimenRes; //導入依賴的package包/類
public Builder marginResId(@DimenRes int leftMarginId, @DimenRes int rightMarginId) {
    return margin(mResources.getDimensionPixelSize(leftMarginId),
            mResources.getDimensionPixelSize(rightMarginId));
}
 
開發者ID:Jusenr,項目名稱:AppFirCloud,代碼行數:5,代碼來源:HorizontalDividerItemDecoration.java

示例13: marginResId

import android.support.annotation.DimenRes; //導入依賴的package包/類
public Builder marginResId(@DimenRes int topMarginId, @DimenRes int bottomMarginId) {
    return margin(mResources.getDimensionPixelSize(topMarginId),
            mResources.getDimensionPixelSize(bottomMarginId));
}
 
開發者ID:Jusenr,項目名稱:AppFirCloud,代碼行數:5,代碼來源:VerticalDividerItemDecoration.java

示例14: setCornerRadiusDimen

import android.support.annotation.DimenRes; //導入依賴的package包/類
public void setCornerRadiusDimen(@DimenRes int resId) {
    float radius = getResources().getDimension(resId);
    setCornerRadius(radius, radius, radius, radius);
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:5,代碼來源:RoundedImageView.java

示例15: setNoNetTextSizeResource

import android.support.annotation.DimenRes; //導入依賴的package包/類
public Builder setNoNetTextSizeResource(@DimenRes int mNoNetTextSizeRes) {
    return setNoNetTextSize(getDimensionPixelSize(mNoNetTextSizeRes));
}
 
開發者ID:AriesHoo,項目名稱:FastLib,代碼行數:4,代碼來源:FastMultiStatusView.java


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