I am attempting to place two TextViews (one of which is <include/>'d) sequentially in a RelativeLayout, but they end up on top of each other.
I have the following res/layout/activity_main.xml:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/main_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.lerenard.test.MainActivity">
<include
android:id="@+id/hello_layout"
layout="@layout/hello_text_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<TextView
android:id="@+id/bonjour_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/bonjour"
android:textSize="@dimen/text_size"
android:layout_below="@id/hello_layout"/>
</RelativeLayout>
res/layout/hello_layout.xml:
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/hello_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/hello"
android:textSize="@dimen/text_size"/>
</merge>
What I would like to see is that bonjour_view is below hello_view. However, they are both squashed on top of each other. That is, it appears that the merge layout that bonjour_view references (hello_layout) has no height. This is supported by the fact that if I replace the merge with a LinearLayout, everything works as expected. However, I'd still like to get the performance benefits of using a merge if that's possible (and it seems like it should be given how simple this example is). I have tried referencing @id/hello_view, but I get Error:(20, 31) No resource found that matches the given name (at 'layout_below' with value '@id/hello_view'). when building the project.