当前位置: 首页>>代码示例>>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;未经允许,请勿转载。