rbrlnx
rbrlnx

Reputation: 286

2 lines in group of expandablelistview

I want to show my groupview with 2 lines to down direction, but only show me one line:

I have this code for the linear_group.xml

    <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center_vertical"
    android:orientation="horizontal" >

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginTop="3dp"
        android:orientation="horizontal" >

        <LinearLayout
            android:layout_width="wrap_content"
            android:layout_height="wrap_content" >

            <ImageView
                android:id="@+id/primerIcono"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="2dp"
                android:src="@drawable/img_transparente"
                android:visibility="visible" />

            <ImageView
                android:id="@+id/segundoIcono"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_marginLeft="2dp"
                android:src="@drawable/img_transparente"
                android:visibility="visible" />
        </LinearLayout>

        <TextView
            android:id="@+id/tvRowCodigo"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginBottom="2dp"
            android:layout_marginLeft="10dp"
            android:layout_marginTop="7dp"
            android:singleLine="true"
            android:text="12345"
            android:textSize="12dp"
            android:textStyle="bold" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="match_parent"
            android:layout_marginLeft="5dp"
            android:layout_marginTop="3dp"
            android:layout_weight="3"
            android:orientation="horizontal"
            android:weightSum="3" >

            <TextView
                android:id="@+id/tvRowDireccion"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:text="Medium Text"
                android:textAppearance="?android:attr/textAppearanceMedium" />

            <TextView
                android:id="@+id/tvRowGremio"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:text="Medium Text"
                android:textAppearance="?android:attr/textAppearanceMedium" />

            <TextView
                android:id="@+id/tvRowFechaCad"
                android:layout_width="fill_parent"
                android:layout_height="fill_parent"
                android:layout_weight="1"
                android:text="Medium Text"
                android:textAppearance="?android:attr/textAppearanceMedium" />
        </LinearLayout>
    </LinearLayout>
</LinearLayout> 

The 3 first imageview are icons, but the next textviews there are that i want to show in more lines, but only show me the first. I'm attaching a screenshot

Edit:

The expandablelistview dont show me all the textview, the second and the third textview are "direccion del servicio" and gremio del estudiandte y profesion" but only show me direccion del and gremio del. I want to show te rest in a second line

Upvotes: 1

Views: 566

Answers (2)

Jaypoulz
Jaypoulz

Reputation: 110

Alright, so the description of the problem was a little difficult to read, but I'll try to point you in the right direction. I'm under the assumption that you are trying to list the profession, direction, and date TextView on separate lines.

Try changing the xml this:

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="wrap_content"
    android:gravity="center_vertical"
    android:orientation="vertical" >      <-make this one vertical

<LinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:layout_marginTop="3dp"
    android:orientation="horizontal" >

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content" >

        <ImageView
            android:id="@+id/primerIcono"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="2dp"
            android:src="@drawable/img_transparente"
            android:visibility="visible" />

        <ImageView
            android:id="@+id/segundoIcono"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_marginLeft="2dp"
            android:src="@drawable/img_transparente"
            android:visibility="visible" />
    </LinearLayout>

    <TextView
        android:id="@+id/tvRowCodigo"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_marginBottom="2dp"
        android:layout_marginLeft="10dp"
        android:layout_marginTop="7dp"
        android:singleLine="true"
        android:text="12345"
        android:textSize="12dp"
        android:textStyle="bold" />

  <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_marginLeft="5dp"
        android:layout_marginTop="3dp"
        android:layout_weight="3"
        android:orientation="horizontal"
        android:weightSum="3" >

       <TextView
            android:id="@+id/tvRowDireccion"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"              <- instead of fill_parent
            android:layout_weight="1"
            android:text="Medium Text"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <TextView
            android:id="@+id/tvRowGremio"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"              <- instead of fill_parent
            android:layout_weight="1"
            android:text="Medium Text"
            android:textAppearance="?android:attr/textAppearanceMedium" />

        <TextView
            android:id="@+id/tvRowFechaCad"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"              <- instead of fill_parent
            android:layout_weight="1"
            android:text="Medium Text"
            android:textAppearance="?android:attr/textAppearanceMedium" />
    </LinearLayout>
  </LinearLayout>
</LinearLayout> 

Upvotes: 1

Barak
Barak

Reputation: 16393

You need to change the XML to use both Horizontal and vertical LinearLayout callouts. Basically you create a vertical LinearLayout containing two horizontal LinearLayouts.

Like this in pseudo-code:

<LinearLayout Vertical>
    <LinearLayout Horizontal> (row 1)
        Widgets for Row 1
    </LinearLayout>
    <LinearLayout Horizontal> (row 2)
        Widgets for Row 2
    </LinearLayout>
</LinerLayout>

Upvotes: 1

Related Questions