문제

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