Reputation: 511
I have a ListView object in Android that contains objects which have toStrings that write 4 lines of text.
Currently, the ListView defaults to only showing 2 lines of text per element instead of the wanted 4.
I've been looking over google and stackexchange and most of the questions like this have been creating custom XML's and dynamically changing the height of the items in the Listview based on some external parameters.
Before I go to the trouble of making custom XML am I perchance overlooking some stupidly easy means of just changing the listView so that it displays 4 lines instead of 2 lines of text for each element in the listView?
Upvotes: 0
Views: 1163
Reputation: 511
Eventually found this resource to be very helpful:
http://www.androidinterview.com/android-custom-listview-with-image-and-text-using-arrayadapter/
Since I was using the simple_list_item_single_choice as an argument to my adapter, I simply found the source for it on Android's github and copied it into a custom_list_view.xml.
And changed
android:layout_height="?android:attr/listPreferredItemHeightSmall
To
android:layout_height="wrap_content"
Then I called
adapter = new ArrayAdapter<String>(this, R.layout.custom_text_view, connections);
Hope this helps future google users who were as frustrated as I was.
Upvotes: 2
Reputation: 1068
Think your stuck making a custom xml file. Shouldn't be to much work for just a slightly larger view though.
Upvotes: 0