Probleme mit RelativeLayout

bruce85

Bekanntes Mitglied
Hallo,
ich habe ein kleines Problem mit meinem Layout in Android, und zwar möchte ich das so gestalten:
| RelativeLayout1 | "oben"
| RelativeLayout2->ScrollView1->RelativeLayout | "mitte"
| RelativeLayout3 | RelativeLayout4 | RelativeLayout5 | "unten"

Im anhang habe ich ein beispiel Screen hochgeladen.

So habe ich das bis jetzt:
Code:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:layout_gravity="fill_vertical"
    android:id="@+id/mainView">
    <RelativeLayout
        android:id="@+id/topView" 
        android:layout_centerHorizontal="false" 
        android:layout_width="fill_parent" 
        android:background="#ffff8621" 
        android:layout_alignParentTop="true" android:layout_height="50dp">
        <TextView android:layout_width="wrap_content" 
            android:id="@+id/textView" 
            android:layout_alignParentTop="true" 
            android:text="@string/app_name" 
            android:shadowDx="0.1" 
            android:layout_centerHorizontal="true" 
            android:textColor="#000000" 
            android:layout_centerVertical="true" 
            android:layout_height="fill_parent" 
            android:layout_centerInParent="true" 
            android:textSize="8pt" 
            android:height="50px" 
            android:gravity="center_vertical|center_horizontal|center">
        </TextView>
    </RelativeLayout>
    <RelativeLayout
        android:id="@+id/centerView"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_marginBottom="50dp" 
        android:layout_below="@+id/topView">
        <ScrollView
	    	android:id="@+id/scrollView"
	    	android:layout_width="fill_parent"
	    	android:layout_height="fill_parent"
	    	android:layout_alignParentBottom="false"
	    	android:layout_alignParentLeft="true"
	    	android:layout_alignParentRight="true"
	    	android:fillViewport="true"
	    	android:isScrollContainer="true">
    

	 		<RelativeLayout
	     		android:id="@+id/layout_view"
	     		android:layout_width="fill_parent"
	     		android:layout_height="wrap_content"
	     		android:fillViewport="true"
	     		android:scrollbars="horizontal|vertical" >
	 		</RelativeLayout>
		</ScrollView>
    </RelativeLayout>

    <RelativeLayout
        android:id="@+id/bottomView"
        android:layout_width="fill_parent"
        android:layout_height="50dp"
        android:layout_alignParentBottom="true"
        android:background="#ffff8621"
        android:gravity="center" >

    </RelativeLayout>
</RelativeLayout>

Nur bekomme ich die 3 RelativeLayout für unten, nicht richtig hin.
Kann mir da Vielleicht jemand Weiterhelfen?

Danke schonmal für die Hilfe.

Gruss
 

Anhänge

  • screen2.png
    screen2.png
    4,5 KB · Aufrufe: 32
Zuletzt bearbeitet:
1) falsches Unterforum. Es gibt hier eins speziell für Mobile Geräte (na, was ist Android in aller Regel? ;-) )

2) ersetzt "fill_parent" mit "match_parent". Fill ist outdated/deprecated
3) Warum ein derart verschachteltes RelativeLayout? Auch wenn ich das Layout auch gerne mal verwende, würde bei dir ein LinearLayout (vertikal) als parent genügen (height=0dp und weight=1 für den Scrollview). Auch den Footer-Bereich würde ich mit einem LinearLayout machen (horizontal).
4) Alternativ würde sich vermutlich auch ein GridLayout mit drei Spalten gut anbieten. Oder ein TableLayout.

Das Problem ist, das RelativeLayouts schnell sehr unübersichtlich werden (wie in deinem Fall) und man dran verzweifeln möchte.
 

Neue Themen


Zurück
Oben