Reputation: 461
I have following layout file. It has camera preview on half screen and button with it. I want to add a custom View which draws circle. I have done coding the class Custom View class. But now the problem is how/what to do in order to add my Custom view in layout and how to integrate that to my main class. I have not been able to get it properly working so far.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="horizontal"
android:baselineAligned="false">
<LinearLayout
android:id="@+id/camera_preview"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_weight="1"
android:orientation="horizontal">
<MyDrawing
android:id="@+id/Drawing"
android:layout_width="259dp"
android:layout_height="fill_parent"
android:orientation="horizontal"
/>
</LinearLayout>
<LinearLayout
android:id="@+id/buttonsLayout"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_gravity="center"
android:orientation="vertical"
android:weightSum="1">
<Button
android:id="@+id/button_capture"
android:layout_width="wrap_content"
android:layout_height="fill_parent"
android:layout_marginTop="100dp"
android:text="Capture/Stop"
/>
</LinearLayout>
Upvotes: 0
Views: 96
Reputation: 2955
Change this :
<MyDrawing
android:id="@+id/Drawing"
android:layout_width="259dp"
android:layout_height="fill_parent"
android:orientation="horizontal"
/>
To:
<com.package.file.location.MyDrawing
android:id="@+id/Drawing"
android:layout_width="259dp"
android:layout_height="fill_parent"
android:orientation="horizontal"
/>
Always add complete path to the view
Upvotes: 2