one of the fragments used in this app should be a table of mostly numerical data.
6 columns by 15 rows
the top four header rows have some fused cells
that's roughly 90 views (minus the fused cells + the purely layout views - tablelayout, tablerow, for example).
The first problem is a warning that over 80 views is too much, and the app might get laggy.
What can I do about this, considering this fragment/view can't be split? - the user needs access to this table of data all at once.
Secondly, the data in the table is static - and a lot of it is calculable. However different languages don't present numerical data the same way; for example "1,000" in English would be "1000" in French - and would maybe not be represented using roman numerals in some language I don't know.
Should these roughly 30 numerical items go in a /res/values/string_file.xml, considering the file will exist anyways, if only for the table headers, or should the app calculate them, apply a locale filter, and output them to the layout?
Thank you
Related
I'm building an Android app, which will display TV channels schedule.
The view would go something like, the tv guide we view on Tata sky, dish tv or any other service provider, like below:
Table with channel names.
Channel program names in a row, with time defined above, as column header..
Any idea, on how to start with creating this view in Android?
This would be like table with nequal cell widths, connected with time slots above.
Any help would be appreciated.
A possible solution could be to create a custom view that would represent each cell in the TV guide. The cells would need to be defined as focusable and selectable. You would need to decide how many pixels would represent a minute. Say 4 pixels per minute. You'd then calculate a layout width based on (4px per minute x runtime in minutes). Each cell could be added to a linear layout that represents the row. Your 'grid' would be a collection of these horizontal rows.
One caveat about this method is memory usage, you wouldn't have the automatic view recycling that you get in RecyclerView so would need to take care of that manually.
I'm creating a Google Glass app and need to display a simple table. The table will have 2 columns and a varying # of rows.
I'd like the text size to be dynamic based on how many rows are in use. So if you have just 3 rows and the strings in the cells are short (in terms of length) the text size should be larger. If, on the other hand the view updates and now there are 6 rows and/or the string length in the cells is greater, the text size should be reduced.
Plainly put, the text size should be computed so that the text is as large as possible while still fitting the entire table on screen.
Any advice on how to create a layout to achieve this? I found the GridLayout but I think I'll need to dnyamically update it since the # rows can vary. Then there's the text size issue.
This is the kind of problem that is easy on the Web but hard on Android. So one approach might be to put a webview into your app and show an HTML table you generate locally and inject into the webview.
You might have reasons this won't work for you. If you need a more native approach this is a problem that has been solved in native Android apps, basically by measuring the font size to see if it will fit in a space iteratively. You start small and increase the size until it doesn't fit, then use the size before the one that didn't fit.
Here is a thread about that approach:
How to adjust text font size to fit textview
That will adress the difficult issue of text size.
Once that is solved the layouts are easy, many containers will work including GridLayout, TableLayout or even a series of nested LinearLayouts.
I have a scenario where I have to show a huge report which consists of about 16 fields, and the last field consists of a radio group. I've taken a Table layout for this. But the problem is, I don't know the size of each field. I mean, there could be 50 characters in one, and 2 in another, and I have to adjust the width and height basing on that without loosing the look and feel criteria. For example,the first column is a Serial No which may contain 4 digits max, the second column contains an ID which may be a 20 digit number and so on. I can use Wrap Content, but its making the page clumsy! So, my question is, is there any possibility that my fields can automatically set their width and height basing on the length of the characters.Thanks in advance! Any help will be appreciated!
I'm currently working on an android application and I recently came across something which mentioned that an activity should aim to have less than 80 views.
I have a couple tablelayouts with some textviews in each one. Would it be more efficient/possible to have one textview and use html tables to try and achieve the same look I have with the tablelayouts?
It would cut down on the number of views, but would it be worth the time to rework the layout?
To get a Spannable-object (which can be displayed in a TextView) form an HTML snipped, you can use the HTML-class from the Android framework, as illustrated here: How to display HTML in TextView?
However, the docs for this class also state that:
This class processes HTML strings into displayable styled text. Not
all HTML tags are supported.
A nice list of supported tags can be found in this answer and this Blog-Post (Spoiler: <table> is not supported).
Theoretically, having more than 80 views on one Activity is a lot. In pratice, it turns out that this can be handled by many phones with ease.
I created an application that collected Geo-Data and displayed all taken locations in a table (which would have more than 900 items). Even with the full table it scrolls smoothly (on my Motorola Xoom and my HTC Desire HD).
If you should encounter any problems with long lists/tables on certain devices, there is always the option of lazy loading.
It should be a general goal to show the most important/precise data at the top (so the user does not need to scroll at all).
So, you would show the lets say 30 best hits and when the user has scrolled down to number 20 (or so), you asynchronously load the next 30 entries. That way, you get a never ending list (given that the data is endless).
I am building an application for Android (1.5) that, after quering a webservice, shows to the user a big amount of data that should be displayed in a "grid" or "table" style.
I must show a result of about 7 columns and 50 rows (for example a customer list with names, addresses, telephone number, sales amount last year and so).
Obviously, the 7 columns will not fix in the screen and I would like the user would be able to scroll up/down and LEFT/RIGHT (important because of the number of columns) to explore the grid results.
Cell selection level is NOT necessary, as much I would need row selection level.
What is the best approach to get this interface element? Listview / GridView / TableLayout?
I would suggest a grid with rows that are 'expandable' to show the child row containing a subset of the data that you could maybe consider as details. That way the user can look at data for the rows they are interested in, but ignore the rest.
By the objects you mention it looks like you're talking about .NET. In that case GridView will get your data displaying quickly (least programming) and in the most flexible fashion.
All you have to do is assign your contacts data to the grid view's DataSource member and you're done.
I don't know much about Android GUI programming, but the best approach for me would be using landscape orientation, few rows per page (like 5-10) and paging so that GUI will not get slow.
Check out the SlowAdapter, List13 example in the samples folder.
That might answer your questions.
On my PC the path is
"sdk folder"->android-2.1->samples->ApiDemos->src->com->example->android->apis->view
This 2 dimensional scrollview might be what you're looking for: http://androiddevblog.blogspot.com/2009/12/creating-two-dimensions-scroll-view.html
It is using a TableLayout so for reallly large datasets it might not be optimal because the views won't get re-used on scrolling. But 7x50 does'