Include a include-tag within another include-tag



I'm new to asking questions on StackOverFlow so bare with me.


I'm making a simple formulary so me and my high school friends can easily look up certain formulas.


So the problem is that I have made my own "google-card" RelativeLayout, so I can use include-tag in my main XML, but I also want to include images in some formulas and just some text in some formulas. Which mean I can't use just one set of include-tag nor just one xml-file. I've searched all afternoon for an answer but no one mentioned anything about nesting include-tags.


main.xml



<include
android:id="@+id/include"
layout="@layout/test" >

<include android:id="@+id/image"
android:src="@layout/image" />

</include>


test.xml



<RelativeLayout
android:background="@drawable/main_restaurant"
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_marginBottom="@dimen/cardTopBottom"
android:layout_marginLeft="@dimen/cardLeftRight"
android:layout_marginRight="@dimen/cardLeftRight"
android:layout_marginTop="@dimen/cardTopBottom"
android:clickable="true"
android:onClick="" />


image.xml



ImageView
android:id="@+id/image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:layout_marginBottom="@dimen/cardTopBottom"
android:layout_marginLeft="@dimen/cardLeftRight"
android:layout_marginRight="@dimen/cardLeftRight"
android:layout_marginTop="@dimen/cardTopBottom"
android:contentDescription="test"
android:scaleType="centerCrop"
android:src="@drawable/cirkeln"/>


This isn't fully finished, I will add more "parts" (more xml-files) as soon as I've managed to nest include-tags.


Would appritiate any kind of help why it's not working.


No comments:

Post a Comment