Hello I am writing a rather large app and on the main page I would like the option to search through all of the pages. Because I need to get and display the different types of information in different ways I have made a few subclasses of ArrayAdapters and I am connecting them to different ListViews on my search results page. This all works fine.
The problem is that the result sets are sometimes too large to fit on a single screen. The result is that I can't scroll past the first set of results to see the other listViews. I have tried to put the listViews into a scrollView but I am getting this error:
java.lang.UnsupportedOperationException: addView(View, LayoutParams) is not supported in AdapterView
I have done some research on this problem and most people that get it seem to be getting it for completely different reasons. The code totally works if it is not in a scrollview (except the scrolling) but nesting the listViews seems to make the program mad and it开发者_Python百科 wont even get past setContentView.
So my questions are:
Am I approaching this correctly? Is there a way to display several Adapters at the same time in 1 listview?
Is there any way to scroll without adding a scrollview?
- Generally putting multiple listviews in one Activity isn't a good thing if it requires lots of scrolling. Having said that, all UI's are different, so if that's how you want to do it then post some code and we can help you troubleshoot that exception.
Personally, I would create multiple "activities" with some sort of menu system (like a simple static website) to link them together. Or if you truly want one page, use a button to page through each listview, where each button click removes the previous and populates the next.
2 No, unfortunately you can't use more than the device's screensize without a scrollview.
Welcome to Stackoverflow - I rather like your username...
精彩评论