android.view.TextureView.onMeasure()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.6k)|赞(0)|评价(0)|浏览(154)

本文整理了Java中android.view.TextureView.onMeasure()方法的一些代码示例,展示了TextureView.onMeasure()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。TextureView.onMeasure()方法的具体详情如下:
包路径:android.view.TextureView
类名称:TextureView
方法名:onMeasure

TextureView.onMeasure介绍

暂无

代码示例

代码示例来源:origin: Naoki2015/CircleDemo

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  if (mContentWidth != null && mContentHeight != null) {
    updateTextureViewSize();
  }
}

代码示例来源:origin: googlesamples/android-Camera2Basic

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  int width = MeasureSpec.getSize(widthMeasureSpec);
  int height = MeasureSpec.getSize(heightMeasureSpec);
  if (0 == mRatioWidth || 0 == mRatioHeight) {
    setMeasuredDimension(width, height);
  } else {
    if (width < height * mRatioWidth / mRatioHeight) {
      setMeasuredDimension(width, width * mRatioHeight / mRatioWidth);
    } else {
      setMeasuredDimension(height * mRatioWidth / mRatioHeight, height);
    }
  }
}

代码示例来源:origin: googlesamples/android-Camera2Video

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  int width = MeasureSpec.getSize(widthMeasureSpec);
  int height = MeasureSpec.getSize(heightMeasureSpec);
  if (0 == mRatioWidth || 0 == mRatioHeight) {
    setMeasuredDimension(width, height);
  } else {
    if (width < height * mRatioWidth / mRatioHeight) {
      setMeasuredDimension(width, width * mRatioHeight / mRatioWidth);
    } else {
      setMeasuredDimension(height * mRatioWidth / mRatioHeight, height);
    }
  }
}

代码示例来源:origin: brianwernick/ExoMedia

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  if (!measureBasedOnAspectRatio) {
    super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    notifyOnSizeChangeListener(getMeasuredWidth(), getMeasuredHeight());
    return;

代码示例来源:origin: cachapa/AerialDream

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  if (aspectRatio > 0) {
    int newWidth;
    int newHeight;
    newHeight = MeasureSpec.getSize(heightMeasureSpec);
    newWidth = (int) (newHeight * aspectRatio);
    widthMeasureSpec = MeasureSpec.makeMeasureSpec(newWidth, MeasureSpec.EXACTLY);
  }
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}

代码示例来源:origin: CarGuo/RecordWave

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
    creatBackGroundBitmap();
}

代码示例来源:origin: googlesamples/android-Camera2Raw

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  int width = MeasureSpec.getSize(widthMeasureSpec);
  int height = MeasureSpec.getSize(heightMeasureSpec);
  if (0 == mRatioWidth || 0 == mRatioHeight) {
    setMeasuredDimension(width, height);
  } else {
    if (width < height * mRatioWidth / mRatioHeight) {
      setMeasuredDimension(width, width * mRatioHeight / mRatioWidth);
    } else {
      setMeasuredDimension(height * mRatioWidth / mRatioHeight, height);
    }
  }
}

代码示例来源:origin: werbhelius/MediaUtils

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  int width = MeasureSpec.getSize(widthMeasureSpec);
  int height = MeasureSpec.getSize(heightMeasureSpec);
  if (0 == mRatioWidth || 0 == mRatioHeight) {
    setMeasuredDimension(width, height);
  } else {
    if (width < height * mRatioWidth / mRatioHeight) {
      setMeasuredDimension(width, width * mRatioHeight / mRatioWidth);
    } else {
      setMeasuredDimension(height * mRatioWidth / mRatioHeight, height);
    }
  }
}

代码示例来源:origin: tzutalin/Android-Object-Detection

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  int width = MeasureSpec.getSize(widthMeasureSpec);
  int height = MeasureSpec.getSize(heightMeasureSpec);
  if (0 == mRatioWidth || 0 == mRatioHeight) {
    setMeasuredDimension(width, height);
  } else {
    if (width < height * mRatioWidth / mRatioHeight) {
      setMeasuredDimension(width, width * mRatioHeight / mRatioWidth);
    } else {
      setMeasuredDimension(height * mRatioWidth / mRatioHeight, height);
    }
  }
}

代码示例来源:origin: peekler/GDG

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  int width = MeasureSpec.getSize(widthMeasureSpec);
  int height = MeasureSpec.getSize(heightMeasureSpec);
  if (0 == mRatioWidth || 0 == mRatioHeight) {
    setMeasuredDimension(width, height);
  } else {
    if (width < height * mRatioWidth / mRatioHeight) {
      setMeasuredDimension(width, width * mRatioHeight / mRatioWidth);
    } else {
      setMeasuredDimension(height * mRatioWidth / mRatioHeight, height);
    }
  }
}

代码示例来源:origin: JustinRoom/JSCKit

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  int width = MeasureSpec.getSize(widthMeasureSpec);
  int height = MeasureSpec.getSize(heightMeasureSpec);
  if (0 == mRatioWidth || 0 == mRatioHeight) {
    setMeasuredDimension(width, height);
  } else {
    if (width < height * mRatioWidth / mRatioHeight) {
      setMeasuredDimension(width, width * mRatioHeight / mRatioWidth);
    } else {
      setMeasuredDimension(height * mRatioWidth / mRatioHeight, height);
    }
  }
}

代码示例来源:origin: Gutyn/camera2QRcodeReader

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  int width = MeasureSpec.getSize(widthMeasureSpec);
  int height = MeasureSpec.getSize(heightMeasureSpec);
  if (0 == mRatioWidth || 0 == mRatioHeight) {
    setMeasuredDimension(width, height);
  } else {
    if (width < height * mRatioWidth / mRatioHeight) {
      setMeasuredDimension(width, width * mRatioHeight / mRatioWidth);
    } else {
      setMeasuredDimension(height * mRatioWidth / mRatioHeight, height);
    }
  }
}

代码示例来源:origin: BlinkID/blinkid-android

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  int width = MeasureSpec.getSize(widthMeasureSpec);
  int height = MeasureSpec.getSize(heightMeasureSpec);
  if (0 == mRatioWidth || 0 == mRatioHeight) {
    setMeasuredDimension(width, height);
  } else {
    if (width < height * mRatioWidth / mRatioHeight) {
      setMeasuredDimension(width, width * mRatioHeight / mRatioWidth);
    } else {
      setMeasuredDimension(height * mRatioWidth / mRatioHeight, height);
    }
  }
}

代码示例来源:origin: raulh82vlc/Image-Detection-Samples

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  int width = MeasureSpec.getSize(widthMeasureSpec);
  int height = MeasureSpec.getSize(heightMeasureSpec);
  if (0 == mRatioWidth || 0 == mRatioHeight) {
    setMeasuredDimension(width, height);
  } else {
    if (width < height * mRatioWidth / mRatioHeight) {
      setMeasuredDimension(width, width * mRatioHeight / mRatioWidth);
    } else {
      setMeasuredDimension(height * mRatioWidth / mRatioHeight, height);
    }
  }
}

代码示例来源:origin: blinkinput/blinkinput-android

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  int width = MeasureSpec.getSize(widthMeasureSpec);
  int height = MeasureSpec.getSize(heightMeasureSpec);
  if (0 == mRatioWidth || 0 == mRatioHeight) {
    setMeasuredDimension(width, height);
  } else {
    if (width < height * mRatioWidth / mRatioHeight) {
      setMeasuredDimension(width, width * mRatioHeight / mRatioWidth);
    } else {
      setMeasuredDimension(height * mRatioWidth / mRatioHeight, height);
    }
  }
}

代码示例来源:origin: PDF417/pdf417-android

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  int width = MeasureSpec.getSize(widthMeasureSpec);
  int height = MeasureSpec.getSize(heightMeasureSpec);
  if (0 == mRatioWidth || 0 == mRatioHeight) {
    setMeasuredDimension(width, height);
  } else {
    if (width < height * mRatioWidth / mRatioHeight) {
      setMeasuredDimension(width, width * mRatioHeight / mRatioWidth);
    } else {
      setMeasuredDimension(height * mRatioWidth / mRatioHeight, height);
    }
  }
}

代码示例来源:origin: lijundacom/AndroidRTSPLib2

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  int width = MeasureSpec.getSize(widthMeasureSpec);
  int height = MeasureSpec.getSize(heightMeasureSpec);
  if (0 == mRatioWidth || 0 == mRatioHeight) {
    setMeasuredDimension(width, height);
  } else {
    if (width < height * mRatioWidth / mRatioHeight) {
      setMeasuredDimension(width, width * mRatioHeight / mRatioWidth);
    } else {
      setMeasuredDimension(height * mRatioWidth / mRatioHeight, height);
    }
  }
}

代码示例来源:origin: mhidaka/Camera2App

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  int width = MeasureSpec.getSize(widthMeasureSpec);
  int height = MeasureSpec.getSize(heightMeasureSpec);
  if (0 == mRatioWidth || 0 == mRatioHeight) {
    setMeasuredDimension(width, height);
  } else {
    if (width < height * mRatioWidth / mRatioHeight) {
      setMeasuredDimension(width, width * mRatioHeight / mRatioWidth);
    } else {
      setMeasuredDimension(height * mRatioWidth / mRatioHeight, height);
    }
  }
}

代码示例来源:origin: Hemumu/WallpaperDemo

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  int width = MeasureSpec.getSize(widthMeasureSpec);
  int height = MeasureSpec.getSize(heightMeasureSpec);
  if (0 == mRatioWidth || 0 == mRatioHeight) {
    setMeasuredDimension(width, height);
  } else {
    if (width < height * mRatioWidth / mRatioHeight) {
      setMeasuredDimension(width, width * mRatioHeight / mRatioWidth);
    } else {
      setMeasuredDimension(height * mRatioWidth / mRatioHeight, height);
    }
  }
}

代码示例来源:origin: pedroSG94/rtmp-rtsp-stream-client-java

@Override
 protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
  super.onMeasure(widthMeasureSpec, heightMeasureSpec);
  int width = MeasureSpec.getSize(widthMeasureSpec);
  int height = MeasureSpec.getSize(heightMeasureSpec);
  if (0 == mRatioWidth || 0 == mRatioHeight) {
   setMeasuredDimension(width, height);
  } else {
   if (width < height * mRatioWidth / mRatioHeight) {
    setMeasuredDimension(width, width * mRatioHeight / mRatioWidth);
   } else {
    setMeasuredDimension(height * mRatioWidth / mRatioHeight, height);
   }
  }
 }
}

相关文章