Camera X Aspect ratio Changes

739 views
Skip to first unread message
Assigned to charco...@google.com by wuj...@google.com

Shyam Kumar

unread,
Dec 3, 2020, 2:53:32 AM12/3/20
to Android CameraX Discussion Group
Using this code  "SetTargetAspectRatio(screenAspectRatio) I have  changed the ratio from 9:16 to 4:3 for the preview . But it doesn't the changing also it's Still showing full screen. 

Thanks,
ShyamKumar M

Charcoal Chen

unread,
Dec 3, 2020, 9:51:16 PM12/3/20
to Shyam Kumar, Android CameraX Discussion Group
Hi,

The target aspect ratio setting affects the selected resolution of the source stream for the Preview use case. Did you use PreviewView for the Preview use case? PreviewView's default scale type setting is ScaleType#FILL_CENTER. It will scale the source stream image to fill the output view. Therefore, no matter which target aspect ratio is set, you will see the output view fully filled. Maybe you can change the scale type to ScaleType#FIT_CENTER. Then, you will see the source stream images that are displayed centrally inside your output view and the aspect ratio of the source stream is maintained. If my assumption about the usage of PreviewView is incorrect, please let me know and provide more detailed information so that we can clarify the issue. Thanks.

--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/8eac7b30-904f-4ba5-9bff-2eff3d3faf47n%40android.com.
Reply all
Reply to author
Forward
0 new messages