android - How to draw on top on layout when calling camera -
i have tried draw shape on layout use camera application. can draw rectangle , circle, need frame. provide me rectangle filled, not frame. have picture show below. , here code of layout.
<linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/linearlayout2" android:background="#ffffff" android:layout_width="wrap_content" android:layout_height="match_parent" > <relativelayout android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_weight="0.91" > <framelayout android:id="@+id/cam_preview" android:layout_width="1120dp" android:layout_height="840dp" android:layout_weight="0.91" > </framelayout> <view android:layout_width="360dp" android:layout_height="525dp" android:layout_marginleft="50dp" android:layout_margintop="157dp" android:layout_weight="0.91" android:background="@drawable/square" /> <view android:layout_width="160dp" android:layout_height="160dp" android:layout_marginleft="840dp" android:layout_margintop="480dp" android:layout_weight="0.91" android:background="@drawable/circle2" /> <view android:layout_width="160dp" android:layout_height="160dp" android:layout_marginleft="840dp" android:layout_margintop="200dp" android:layout_weight="0.91" android:background="@drawable/circle" /> </relativelayout> <linearlayout android:layout_width="160dp" android:layout_height="800dp" android:background="#ffffff" android:orientation="vertical" > <imageview android:id="@+id/button_next" android:layout_width="120dp" android:layout_height="120dp" android:layout_gravity="center_horizontal" android:layout_weight="3" android:src="@drawable/buttonnext" /> <imageview android:id="@+id/button_camera" android:layout_width="120dp" android:layout_height="120dp" android:layout_gravity="center_horizontal" android:layout_weight="2" android:src="@drawable/buttoncamera" /> <imageview android:id="@+id/button_back" android:layout_width="120dp" android:layout_height="120dp" android:layout_gravity="center_horizontal" android:layout_weight="3" android:src="@drawable/buttonback" /> </linearlayout>
circle.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" > <stroke android:width="3dp" android:color="#ffff0000"/> </shape>
square.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <stroke android:width="3dp" android:color="#ffff0000"/> </shape>
note layout fit 10.1 in tablet.
use transparency of colors. square.xml
<?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:padding="10dp" android:shape="rectangle" > <solid android:color="#00ffffff" /> <corners android:bottomleftradius="1dp" android:bottomrightradius="1dp" android:topleftradius="1dp" android:toprightradius="1dp"/> <stroke android:width="1sp" android:color="#ffff0000" />
solid android:color fill color inside rectangle , turn transparent while stroke android:color lines red.
Comments
Post a Comment