List sizeList = parameters.getSupportedPreviewSizes();
int PreviewWidth = 640;
int PreviewHeight = 480;
Boolean findSize = false;
if (sizeList.size() > 1) {
Iterator itor = sizeList.iterator();
while (itor.hasNext()) {
Camera.Size cur = itor.next();
if (cur.width >= PreviewWidth
&& cur.height >= PreviewHeight) {
findSize = true;
PreviewWidth = cur.width;
PreviewHeight = cur.height;
break;
}
}
}
if (!findSize) {
PreviewWidth = sizeList.get(0).width;
PreviewHeight = sizeList.get(0).height;
}
parameters.setPreviewSize(PreviewWidth, PreviewHeight);
时间: 2024-11-02 17:35:15