public void initializeAttributes(AttributeSet attrs) {
        TypedArray styledAttributes = getContext().obtainStyledAttributes(attrs, R.styleable.zxing_camera_preview);

        int framingRectWidth = (int) styledAttributes.getDimension(R.styleable.zxing_camera_preview_zxing_framing_rect_width, -1);
        int framingRectHeight = (int) styledAttributes.getDimension(R.styleable.zxing_camera_preview_zxing_framing_rect_height, -1);

        if (framingRectWidth > 0 && framingRectHeight > 0) {
            this.framingRectSize = new Size(framingRectWidth, framingRectHeight);
        }

        this.useTextureView = styledAttributes.getBoolean(R.styleable.zxing_camera_preview_zxing_use_texture_view, true);

        // See zxing_attrs.xml for the enum values
        int scalingStrategyNumber = styledAttributes.getInteger(R.styleable.zxing_camera_preview_zxing_preview_scaling_strategy, -1);
        if (scalingStrategyNumber == 1) {
            previewScalingStrategy = new CenterCropStrategy();
        } else if (scalingStrategyNumber == 2) {
            previewScalingStrategy = new FitCenterStrategy();
        } else if (scalingStrategyNumber == 3) {
            previewScalingStrategy = new FitXYStrategy();
        }

        styledAttributes.recycle();
    }
Initialize from XML attributes.

@param attrs the attributes
zxing-android-embedded/src/com/journeyapps/barcodescanner/CameraPreview.java