How to draw corners of rectangle on the camera preview in Android? Can you share a code sample for the same
To acchieve this you can just put your camera preview into a FrameLayout and place a transparent View with this rect inside above the camera preview.
First we are going to create the rectangle:
<?xml version="1.0" encoding="utf-8"?>
android:shape="rectangle">
android:width="1dp"
android:color="@color/white"
android:dashGap="8dp"
android:dashWidth="8dp" />
Then you can put this view over your preview:
<?xml version="1.0" encoding="utf-8"?>
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_width="match_parent"
android:layout_height="match_parent" />
android:layout_width="match_parent"
android:layout_height="match_parent"
padding="32dp"
android:background="@drawable/your_shape" />
EDIT:
after taking a look at your layout the task can be solved by just placing htis view:
padding="32dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@id/record_panel"
android:layout_alignParentTop="true"
android:background="@drawable/your_shape" />
as last item of the layout with the id cameraLayout.
Artigos semelhantes
- What mobile games do you play daily and what keeps you coming back. If you could improve the game, what would you add?
- Do you watch anime and if so, which anime do you watch (sorry if you answered this already I'm new to Quora)?
- Can I know any website to share my poetry?
- Can someone share complete dolby surround titles list available on Disney+ Hotstar?