Place a view over another view
<p>I have a custom toolbar in a separate file called <code>include_toolbar.xml</code>.</p><pre><br /><code><?xml version="1.0" encoding="utf-8"?><br /><android.support.v7.widget.Toolbar<br /> xmlns:android="http://ift.tt/nIICcg"<br /> xmlns:app="http://ift.tt/GEGVYd"<br /> android:id="@+id/include_toolbar"<br /> android:orientation="vertical"<br /> android:layout_width="match_parent"<br /> android:layout_height="wrap_content"<br /> android:background="?attr/colorPrimary"<br /> app:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar" /><br /></code><br /></pre><p><a href="http://ift.tt/1WFogTt" rel="nofollow"><img src="http://ift.tt/1WFogTt" alt="enter image description here" /></a></p><p>In a layout for an activity, I want to display this toolbar at the top, a camera preview view and an image button on top of that.</p><pre><br /><code><?xml version="1.0" encoding="utf-8"?><br /><LinearLayout<br /> xmlns:android="http://ift.tt/nIICcg"<br /> xmlns:app="http://ift.tt/GEGVYd"<br /> android:orientation="vertical"<br /> android:layout_width="match_parent"<br /> android:layout_height="match_parent"><br /><br /> <include layout="@layout/include_toolbar" /><br /><br /> <com.journeyapps.barcodescanner.CompoundBarcodeView<br /> app:zxing_result_view="@color/zxing_custom_result_view"<br /> android:id="@+id/activity_scan_barcodeView"<br /> android:layout_width="match_parent"<br /> android:layout_height="match_parent"><br /> </com.journeyapps.barcodescanner.CompoundBarcodeView><br /><br /> <ImageButton<br /> android:id="@+id/activity_scan_flashlight"<br /> android:layout_width="wrap_content"<br /> android:layout_height="wrap_content"<br /> android:layout_alignParentBottom="true"<br /> android:layout_alignLeft="@id/activity_scan_barcodeView"<br /> android:src="@drawable/btn_flashOn"/><br /><br /></LinearLayout><br /></code><br /></pre><p><a href="http://ift.tt/1UjAJ0x" rel="nofollow"><img src="http://ift.tt/1UjAJ0x" alt="enter image description here" /></a></p><p>The <code>CompoundBarcodeView</code> is a component from <a href="http://ift.tt/1AHaaaK" rel="nofollow">this</a> library.</p><p>The problem with the <code>LinearLayout</code> is that the image button is not displayed.</p><p>If I change it to <code>RelativeLayout</code>, the image button is displayed but now the toolbar is gone.</p><p><a href="http://ift.tt/1UjAGBP" rel="nofollow"><img src="http://ift.tt/1UjAGBP" alt="enter image description here" /></a></p><p>How do I get both of them to display?</p><br /><h2>Click here view more answers <a href="http://ift.tt/1WFoji4">http://ift.tt/1WFoji4</a></h2>
Nhận xét
Đăng nhận xét