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

有帮助吗?

解决方案

First use LinearLayout instead of GridLayout.

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top