2016-09-17 8 views
0

Hallo Im haben Probleme beim Ausrichten von Daten Ich zeige in einem ListView auf die Textview, die ich als Header.Im ein Neuling und ich wollte ursprünglich eine LayoutTable verwenden, aber es ist kompliziert, wenn Sie mir eine Idee geben können In diesem Punkt wird großartig sein.Wie man ListView auf TextView

Ich will alles

See Xml unter seinem Kopf parallel sein:

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent" 
android:gravity="center" 
android:orientation="vertical" > 

<LinearLayout 
    android:orientation="horizontal" 
    android:id="@+id/linearlayout2" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content" 
    android:layout_marginTop="10dp"> 

    <TextView 
     android:id="@+id/w_r" 
     android:layout_width="wrap_content" 
     android:layout_height="40dp" 
     android:orientation="vertical" 
     android:text="what" 
     android:textSize="20dp" 
     android:layout_marginLeft="10dp" /> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="40dp" 
     android:text="where" 
     android:id="@+id/f_l" 
     android:layout_marginLeft="50dp" 
     android:textSize="20dp" /> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="40dp" 
     android:layout_marginLeft="50dp" 
     android:orientation="vertical" 
     android:text="???" 
     android:id="@+id/w_f" 
     android:textSize="20dp" /> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="40dp" 
     android:gravity="center" 
     android:orientation="vertical" 
     android:text="Storing" 
     android:id="@+id/S_r" 
     android:layout_marginLeft="55dp" 
     android:textSize="20dp" /> 

    <TextView 
     android:layout_width="wrap_content" 
     android:layout_height="wrap_content" 
     android:text="look" 
     android:id="@+id/looks" 
     android:textSize="20dp" 
     android:layout_marginLeft="50dp" /> 
</LinearLayout> 

<ListView 
    android:id="@+id/listarecdatos" 
    android:layout_width="fill_parent" 
    android:layout_height="fill_parent" 
    android:layout_alignParentLeft="false" 
    android:layout_alignParentStart="false" 
    android:layout_alignParentBottom="false" 
    android:layout_below="@+id/linearlayout2" 
    android:layout_marginTop="10dp" 
    android:footerDividersEnabled="false" 
    android:layout_marginLeft="10dp" /> 

+2

Do gesetzt Hast du keinen Screenshot? –

+0

Sie lassen mich die Bilder nicht zeigen, weil ich 10 Punkte noch nicht habe. aber da ist eine Verbindung. danke im voraus – Manuel

+0

"' [Code hier eingeben] '" ... Bist du wirklich so faul? –

Antwort

-1

Verwenden Gewichte für beiden Layout-Container, die jeweils Spalten Gewicht von 1 in Ihrem Header-Layout haben muss und in Ihrem Artikel Layout

EDIT - in Beispielcode

Ihre Aktivität/Fragment, das den Header enthält, und der Blick Inhaber der einzelnen Elemente Layout aussehen sollte dieses

<LinearLayout 
    android:orientation="horizontal" 
    android:layout_width="match_parent" 
    android:layout_height="wrap_content"> 

    <TextView 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" /> 

    <TextView 
     android:layout_width="0dp" 
     android:layout_height="wrap_content" 
     android:layout_weight="1" /> 
</LinearLayout> 

Wenn Sie in einer horizontalen verteilen möchten, dann sollten Sie layout_height="0dp" statt layout_width

+1

Das hat es getan. danke eine Million – Manuel

+1

Bitte geben Sie ein Codebeispiel, um weniger fortgeschrittene Benutzer zu unterstützen. –

+0

@Manuel Wenn dies gelöst wurde, akzeptieren Sie es, wenn Sie können. –

Verwandte Themen