Sunday, 15 May 2011

java - Android Listview - Expand to fit whole screen to eliminate white space -



java - Android Listview - Expand to fit whole screen to eliminate white space -

my problem follows:

i have listview 4 elements @ moment. screen sizes, not utilize entire screen , leaves ugly unused space beneath. i'd expand listview each item spaced evenly , leaves no white space, have been unable find solution.

below image of seeing:

the reddish arrow set in show want empty space beneath filled in spacing items evenly.

the listview basic, nil fancy going on. here code xml files:

<listview android:layout_width="match_parent" android:layout_height="match_parent" android:background="#ffffff" android:id="@+id/categorylistview"/>

the items populated database. hoping there simple solution, haven't been able find one. can help me solution?

try this:

<listview android:layout_width="match_parent" android:layout_height="0dp" //if in vertical linear layout,remove comment, when using android:layout_weight="1" android:background="#ffffff" android:id="@+id/categorylistview"/>

when give layout weight of 1, view expands possible space.

but largely depends on item row xml.

java android listview

No comments:

Post a Comment