Verschiedene xml layouts in relativlayout anzeigen lassen

Hallo Leute
Ich möchte gerne ein layout, dass ich in einer xml datei habe in einem relativelayout anzeigen lassen.
Leider hab ich momentan keine Ahnung wie ich die sache angehen soll. Ich hoffe mir kann einer helfen.
 

dzim

Top Contributor
Hab ich das richtig verstanden? Du willst also ein bereits vorhandenes XML-Layout in ein anderes XML-Layout integrieren?

Wenn ja: Verwende das <include>-Tag
Ein Beispiel aus dem Realen Leben (auch wenn ich hier nur LinearLayouts verwende):
[XML]
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:eek:rientation="vertical" >

<TextView
style="@style/cnlabTextView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="5dp"
android:background="@drawable/footer_shape_rect"
android:gravity="left"
android:text="@string/connectionInfo.dialog.main"
android:textColor="@color/white"
android:textStyle="bold" />

<include
android:id="@+id/linear.base"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="5dp"
layout="@layout/simple_keyvalue_item" />

<include
android:id="@+id/linear.sigstr"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="5dp"
layout="@layout/simple_keyvalueprogress_item"
android:visibility="gone" />
</LinearLayout>
[/XML]
Die Layouts "simple_keyvalue*_item" sind selbst (sehr einfache) LinearLayouts...

Wenn nein: Dann habe ich es wohl nicht verstanden...
 

Ähnliche Java Themen

Neue Themen


Oben