Domanda

When I add listView to my GridLayout it goes out of the screen. ListView should fill whole space between TextView and bottom of the screen. Bellow is example of code (I have to use grid layout because in my concrete situation there is a multi column/rows layout).

I'm new in Android. Thank you.

<GridLayout xmlns:android="http://schemas.android.com/apk/res/android"  
android:id="@+id/gridSearchAuthors"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:columnCount="1"
android:padding="4dp"
android:rowCount="2" >    

<TextView
    android:id="@+id/q"
    android:layout_width="wrap_content"
    android:layout_height="24dp"
    android:layout_row="0"
    android:layout_marginLeft="3dp"
    android:text="Hledaný výraz: " />

<ListView
    android:id="@+id/listview"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"        
    android:layout_row="1" />

</GridLayout>

Image of Layout in eclipse

È stato utile?

Soluzione

First use LinearLayout instead of GridLayout.

Use custom adapter for listview population if you have a complex layout.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top