質問

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