3

I am an experienced developer, but I'm inexperienced on the Android platform. So I am seeking some advice from developers with more experience with Android.

I am building a Honeycomb application using Fragments. One of the fragments calls for a vertically scroll-able read-only "HTML table-like" view with dynamically loaded data. Similar to a spreadsheet, I should have clickable headers which I can implement server-side requests to filter/sort the data.

I am pretty sure this Control doesn't exist yet, am I right? Do I have to build it?

Assuming I have to build it, which existing widget should I extend? ListView, Table, GridView?

I assume I would have one widget for the header, and then wrap the body of the table in a scrollable layout to handle scrolling while keeping the header visible. I am concerned that I might not be able to guarantee that the headers line up with the columns.

Thanks in advance,

Tim

knaak
  • 1,293
  • 1
  • 12
  • 18
  • Were you ever successful with this? I am working on a similar project and am trying to figure out how to implement this as well. – dynamphorous Jul 19 '12 at 15:35

1 Answers1

0

Android layouts are pretty basic - there are not any shipped layouts that will really do what you are looking for automatically, but you could probably do what you want with a heavily controlled gridView. Android is also pretty bad about controlling multiple elements to fit within the screen size, as it's goal is to support multiple screen sizes and densities.

From what I understand your desire to be, I think the best solution is to create a nx2 grid view dynamically, and control the width of the view based on the device size. You would have n number of headers on the top, and you could fill the lower half of the grid with your textViews, or whatever data you wanted. The hard part would be keeping the widths of the grid elements under control and on the screen. In addition, you will probably find that you can only fit a small number of header items on the screen because of the phone's small size, so you may discover a better layout to fit your needs.

Noah
  • 1,966
  • 1
  • 14
  • 29
  • The app is an tablet application, so screen size is a little more generous. I will try your approach if my approach fails. I tried TableLayout first with dynamically (Java) created TableRows. I chose TableLayout first because I can easily stretch one column for extra width and then set a weight on the others. It also guarentees that my rows will line up to my headers. My headers are all Button which I attach OnClickListeners for the purpose of ranking. It works okay, only problem is ScrollView must wrap the TableLayout so I can't keep the headers visible... i'll keep trying. Thanks! – knaak Aug 08 '11 at 17:06