juergen d
juergen d

Reputation: 204784

Android ListView items aligned on top

I have an Android ListView.

<ListView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:id="@+id/myListView"
        android:layout_centerVertical="true"
        android:layout_centerHorizontal="true" >

Sometimes it contains only a few items, sometimes just one.

When this is the case, these few items are centered on the listview. But I want the items start from the top and not be centered.

How to do it?

Upvotes: 4

Views: 746

Answers (1)

Nitesh
Nitesh

Reputation: 263

android:layout_centerVertical="true"
android:layout_centerHorizontal="true"

above 2 lines made your listview to center of its parent.hence you got items are centered on the listview.

Can you remove android:layout_centerVertical="true" from your code and try again?

Upvotes: 2

Related Questions