I would like to create a layout as in the image. It did not include him, so the code is very long. I want to create a layout for each BOX and include it in the main layout, one below the other.
The problem is that the XML file a layout of this type is very long. So I would use includes layout and create a new layout which then repeatedly will include, for example:
I have a RelativeLayout, and I have an ImageView for the line1, below I want to design the box in this method to reduce the code:
<include layout = "box1"
layoutBelow = "linea1"
/>
And the same for the box 2:
<include layout = "box2"
layoutBelow = "linea2"
/>
But the layout I include not aligned as I would like. The layout is superimposed on the existing one.
I have solved in this way:
<!-- LINE SEPARATOR 1-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/logo"
android:id="@+id/linea1"
android:background="@drawable/linea"
/>
<!-- BOX1 -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/linea1"
>
<include
layout="@layout/box1"
android:layout_height="wrap_content"
android:layout_width="match_parent"
/>
</RelativeLayout>
<!-- LINE SEPARATOR 2-->
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/logo"
android:id="@+id/linea2"
android:background="@drawable/linea"
/>
<!-- BOX2 -->
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/linea2"
>
<include
layout="@layout/box2"
android:layout_height="wrap_content"
android:layout_width="match_parent"
/>
</RelativeLayout>
And the result is this image:
Thanks you all :)
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments