-
-
Notifications
You must be signed in to change notification settings - Fork 68
Description
The “aim” indicator in CameraView (Android) is currently drawn with a fixed semi-transparent red paint and there’s no public API to override it. Apps that want the indicator to match their branding or accessibility guidelines must resort to fragile reflection hacks.
Expected Behavior
CameraView should expose a single bindable Color property for the aim indicator. The Color’s alpha channel determines opacity. For example, if you want a 50%-opaque blue circle, you would set the property to #800000FF.
Proposed Solution
Add a bindable property to CameraView:
public static readonly BindableProperty AimIndicatorColorProperty =
BindableProperty.Create(
nameof(AimIndicatorColor),
typeof(Color),
typeof(CameraView),
Colors.Red);
public Color AimIndicatorColor
{
get => (Color)GetValue(AimIndicatorColorProperty);
set => SetValue(AimIndicatorColorProperty, value);
}
In the Android renderer (CameraManager), replace the hard-coded paint:
// Old
new Paint
{
AntiAlias = true,
Color = Color.Red,
Alpha = 150
}
with:
var paint = new Paint { AntiAlias = true };
var platformColor = cameraView.AimIndicatorColor.ToPlatform();
paint.Color = platformColor;
Default the color to Colors.Red (with whatever default alpha that represents) so existing behavior remains unchanged.