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


Java ProgressBar.measure方法代码示例

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


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

示例1: convertBetteryBitmap

import android.widget.ProgressBar; //导入方法依赖的package包/类
public void convertBetteryBitmap() {
    batteryView = (ProgressBar) LayoutInflater.from(mContext).inflate(R.layout.layout_battery_progress, null);
    batteryView.setProgressDrawable(ContextCompat.getDrawable(mContext,
            SettingManager.getInstance().getReadTheme() < 4 ?
                    R.drawable.seekbar_battery_bg : R.drawable.seekbar_battery_night_bg));
    batteryView.setProgress(battery);
    batteryView.setDrawingCacheEnabled(true);
    batteryView.measure(View.MeasureSpec.makeMeasureSpec(ScreenUtils.dpToPxInt(26), View.MeasureSpec.EXACTLY),
            View.MeasureSpec.makeMeasureSpec(ScreenUtils.dpToPxInt(14), View.MeasureSpec.EXACTLY));
    batteryView.layout(0, 0, batteryView.getMeasuredWidth(), batteryView.getMeasuredHeight());
    batteryView.buildDrawingCache();
    //batteryBitmap = batteryView.getDrawingCache();
    // tips: @link{https://github.com/JustWayward/BookReader/issues/109}
    batteryBitmap = Bitmap.createBitmap(batteryView.getDrawingCache());
    batteryView.setDrawingCacheEnabled(false);
    batteryView.destroyDrawingCache();
}
 
开发者ID:ynztlxdeai,项目名称:TextReader,代码行数:18,代码来源:PageFactory.java

示例2: measure

import android.widget.ProgressBar; //导入方法依赖的package包/类
@Override
public long measure(
    YogaNode node,
    float width,
    YogaMeasureMode widthMode,
    float height,
    YogaMeasureMode heightMode) {
  final int style = ReactProgressBarViewManager.getStyleFromString(getStyle());
  if (!mMeasured.contains(style)) {
    ProgressBar progressBar = ReactProgressBarViewManager.createProgressBar(getThemedContext(), style);
    final int spec = View.MeasureSpec.makeMeasureSpec(
        ViewGroup.LayoutParams.WRAP_CONTENT,
        View.MeasureSpec.UNSPECIFIED);
    progressBar.measure(spec, spec);
    mHeight.put(style, progressBar.getMeasuredHeight());
    mWidth.put(style, progressBar.getMeasuredWidth());
    mMeasured.add(style);
  }

  return YogaMeasureOutput.make(mWidth.get(style), mHeight.get(style));
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:22,代码来源:ProgressBarShadowNode.java

示例3: testProgressBarSizes

import android.widget.ProgressBar; //导入方法依赖的package包/类
/**
 * Test that the sizes of the progressBars are setup correctly
 */
public void testProgressBarSizes() {
  for (String style : styleList) {
    ProgressBar newProgressBar =
        new ProgressBar(getContext(), null, styles.get(style));
    final int spec = View.MeasureSpec.makeMeasureSpec(
        ViewGroup.LayoutParams.WRAP_CONTENT,
        View.MeasureSpec.UNSPECIFIED);
    newProgressBar.measure(spec, spec);
    final int expectedHeight = newProgressBar.getMeasuredHeight();

    // verify correct size of view containing ProgressBar
    View viewContainingProgressBar = getViewByTestId(mRootView, style);
    assertEquals(expectedHeight, viewContainingProgressBar.getHeight());

    assertTrue(((ViewGroup) viewContainingProgressBar).getChildAt(0) instanceof ProgressBar);
  }
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:21,代码来源:ProgressBarTestCase.java

示例4: measure

import android.widget.ProgressBar; //导入方法依赖的package包/类
@Override
public long measure(
    YogaNodeAPI node,
    float width,
    YogaMeasureMode widthMode,
    float height,
    YogaMeasureMode heightMode) {
  final int style = ReactProgressBarViewManager.getStyleFromString(getStyle());
  if (!mMeasured.contains(style)) {
    ProgressBar progressBar = ReactProgressBarViewManager.createProgressBar(getThemedContext(), style);
    final int spec = View.MeasureSpec.makeMeasureSpec(
        ViewGroup.LayoutParams.WRAP_CONTENT,
        View.MeasureSpec.UNSPECIFIED);
    progressBar.measure(spec, spec);
    mHeight.put(style, progressBar.getMeasuredHeight());
    mWidth.put(style, progressBar.getMeasuredWidth());
    mMeasured.add(style);
  }

  return YogaMeasureOutput.make(mWidth.get(style), mHeight.get(style));
}
 
开发者ID:qq565999484,项目名称:RNLearn_Project1,代码行数:22,代码来源:ProgressBarShadowNode.java


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