当前位置: 首页>>代码示例>>Java>>正文


Java ScreenUtils.dpToPxInt方法代码示例

本文整理汇总了Java中com.justwayward.reader.utils.ScreenUtils.dpToPxInt方法的典型用法代码示例。如果您正苦于以下问题:Java ScreenUtils.dpToPxInt方法的具体用法?Java ScreenUtils.dpToPxInt怎么用?Java ScreenUtils.dpToPxInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.justwayward.reader.utils.ScreenUtils的用法示例。


在下文中一共展示了ScreenUtils.dpToPxInt方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: convert

import com.justwayward.reader.utils.ScreenUtils; //导入方法依赖的package包/类
@Override
public void convert(EasyLVHolder holder, int position, String s) {
    holder.setText(R.id.tvMinorItem, s);

    if (current == position) {
        holder.setVisible(R.id.ivMinorChecked, true);
    } else {
        holder.setVisible(R.id.ivMinorChecked, false);
    }

    if (position != 0) { // 子项右移
        TextView textView = holder.getView(R.id.tvMinorItem);
        RelativeLayout.LayoutParams params = (RelativeLayout.LayoutParams) textView.getLayoutParams();
        params.leftMargin = ScreenUtils.dpToPxInt(25);
        textView.setLayoutParams(params);
    }
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:18,代码来源:MinorAdapter.java

示例2: PageFactory

import com.justwayward.reader.utils.ScreenUtils; //导入方法依赖的package包/类
public PageFactory(Context context, int width, int height, int fontSize, String bookId,
                   List<BookMixAToc.mixToc.Chapters> chaptersList) {
    mContext = context;
    mWidth = width;
    mHeight = height;
    mFontSize = fontSize;
    mLineSpace = mFontSize / 5 * 2;
    mNumFontSize = ScreenUtils.dpToPxInt(16);
    marginWidth = ScreenUtils.dpToPxInt(15);
    marginHeight = ScreenUtils.dpToPxInt(15);
    mVisibleHeight = mHeight - marginHeight * 2 - mNumFontSize * 2 - mLineSpace * 2;
    mVisibleWidth = mWidth - marginWidth * 2;
    mPageLineCount = mVisibleHeight / (mFontSize + mLineSpace);
    rectF = new Rect(0, 0, mWidth, mHeight);

    mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mPaint.setTextSize(mFontSize);
    mPaint.setTextSize(ContextCompat.getColor(context, R.color.chapter_content_day));
    mPaint.setColor(Color.BLACK);
    mTitlePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
    mTitlePaint.setTextSize(mNumFontSize);
    mTitlePaint.setColor(ContextCompat.getColor(AppUtils.getAppContext(), R.color.chapter_title_day));
    timeLen = (int) mTitlePaint.measureText("00:00");
    percentLen = (int) mTitlePaint.measureText("00.00%");
    // Typeface typeface = Typeface.createFromAsset(context.getAssets(),"fonts/FZBYSK.TTF");
    // mPaint.setTypeface(typeface);
    // mNumPaint.setTypeface(typeface);

    this.bookId = bookId;
    this.chaptersList = chaptersList;

    time = dateFormat.format(new Date());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:34,代码来源:PageFactory.java


注:本文中的com.justwayward.reader.utils.ScreenUtils.dpToPxInt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。