I want to create a smartphone app (Android for starters) which in its base core of data displaying, will have a list of many titles in a long header (long horizontal) and also displays many items (long vertical).
I guess I can avoid the long vertical by restricting the number of items in a page, but what is a proper way to display a long horizontal list on a smartphone screen? Should it be enough to have horizontal scrolling? should I force a landscape view?
Please notice I'm not asking about the technical stuff of HOW to create it, but rather more about the UX point of view of the matter.
Set horizontal view for your view from manifest file.
wrap your view layout with horizontal scroll.
May be it would be help to you.
If you share your code then you get more supportive answer.
Related
I understand we always use listview to display list of items instead of Scrollview. But I know we can do it with scrollview also. I understand that performance of list view is better than ScrollView when you want to display list of items. My question is there are any reason for that also? And why nobody use scrollview to display list of items? Please give me your opinion. Thank you.
I often use Scrollview for displaying a limit of items, this number rarely be changed on runtime, such as in a configuration page. Otherwise, ListView is for display a lot of items. Those items may be the same type such as a list of Students, Messages, etc.
ListView uses a concept of dequeueing that is removing view from the view hierarchy when they are not visible. For example if you have 20 items and only 10 are visible at a time.
The listview will remove the top 1st element when 11th element comes
into view using scrolling. This reduces memory load and gives smoother
performance. Battery consumption is major factor of phone these days
and no one wants a app that consumes all the phone battery.
Scrollview on the other hand keeps all the view added in it in the view heirarchy all the time therefore increased memory usage and performance issues when the number of views added are huge.
ScrollView is used to put different or same child views or layouts and the all can be scrolled.
ListView is used to put same child view or layout as multiple items. All these items are also scrollable.
A scrollview on the other hand is quite different. You add other views to a scrollview which allows you to have more elements than what would fit on screen. Say, for example, you wanted to have 50 buttons or a large chunk of text. By using a listview you have a container that is the size of the screen but allows the user to scroll up and down to see the other views.
I'm using DashboardLayout provided by romannurik (https://gist.github.com/romannurik/882650)
This layout adapt children to fit on the screen and I want to implement a vertical scroll.
I want to keep the part to measure the max child per column but if children can't fit on the view I want to be able to scroll.
Can I have any leads to reach this goal ?
Dashboards have sort of become defunct. If you expect there will be enough items that you can need to be able to scroll, then maybe you should just use a GridView.
I'm trying to do something similar to PlayStore app. On the app details page you can see a scroll view which has a horizontal scrolling - "app screen images" and also some details below it like, Description, Reviews, etc...
My Question is: In the PlayStore app, when you scroll the image screen shots horizontally, the vertical scroll is locked and the whole view dose not scroll. Only when you touch and scroll some where below the screen shot images , you can scroll to see other details.
Here is where I'm stuck, Is it possible to do the same with a listView? I have a list view with a custom header View which detects for horizontal scroll gestures, (right to left and viceversa). At that time when the user is touching the header, I do not want the whole view to scroll as a normal listview dose when it has more items. Can some one guide me a solution for this? Check out the PlayStore app in your device for a clear understanding.
Thanks a bunch in advance. I would owe you a drink some day.
Why would you detect the gestures and implement the horizontal scrolling yourself, when there's a special control: HorizontalScrollView which already does this?
I don't know the internal details of Google Play app, but I would put the gallery of screenshots in a custom view, and this custom view to be wrapped in a HorizontalScrollView. Then add this custom view as a header to the ListView (basically how you begun).
As long as the scrolling directions are on different axis - the horizontal scrolling is done on X axis, and the vertical scroll on Y axis - there shouldn't be any problems in holding this.
Post Scriptum:
When you scroll the image screenshots horizontally in the Google Play app, I suppose there's a GalleryView instead of HorizontalScrollView, which can hold this type of transitions.
I'm making a GUI with two different parts. The first part (at the top) is composed of some banners, several fixed buttons. So I think using LinearLayout is the most straightforward way to implement. The second part is composed of several similar items grouped together which can be implemented by using ExpandableListView, I think.
However the problem is that the content exceeds the screen size. So I intend to put two of them into a ScrollView. I checked several sources, it seems that putting "ExpandableListView" inside a ScroolView is NOT possible, or not efficent, so I'm afraid...
Would you help to confirm if this is possible? efficient ?
If no, would you give me some recommendations for this layout design?
I'm indeed looking forward to your supports.
Sincerely.
If you have a fixed header at the top of a list, use ListView's header view feature.
Putting ListViews in ScrollViews fundamentally makes no sense and here is why:
ListView has one purpose: to efficiently display unbounded data sets. Since these can be extremely large (tens of thousands of items and more) you do not want to create a View for each item up front. Instead, ListView asks its Adapter for Views only for the items that currently fit in the ListView's measured space on screen. When an item's View is scrolled out of sight, ListView disconnects that View and hands it back to the adapter to fill out with new data and reuse to show other items. (This is the convertView parameter to an Adapter's getView method.)
ScrollView also has one purpose: to take a single child view and give it "infinite" vertical space to fit within. The user can then scroll up and down to see the full content.
Now given this, how many item Views would a ListView create for a 100,000 item Adapter if it had infinite height available to fill? :)
By putting a ListView inside a ScrollView you defeat ListView's key purpose. The parent ScrollView will give the ListView effectively infinite height to work with, but ListView wants to have a bounded height so that it can provide a limited window into a large data set.
Well Expandable List View itself has scrollable property by placing it in scroll view is really undesirable.As the both scroll would contradict and smooth scrolling can't be obtained in that case..
If we have any data to be shown prior or later to list...
Best way is to use header and footer view to list...
I recommend you use header and footer in your case.
I am developing an app and am looking for some general guidance:
The app is a memory trainer, and will have a couple of different modes:
Numbers: Up to 400 digits will be displayed on the screen in a gridlike pattern
Faces: Images of faces will appear, approximately 9 to a page, also in a grid pattern
The question is: can I accomplish this with a single xml layout file, and should I use the same layout type for each (and if so, what should it be!) ? It's a large app, so consistency would be heavenly.
I would prefer a layout with flexibility, and I am leaning toward GridView right now.
Any thoughts?
A Grid view is basically like a list view where items are arranged in a static grid.
It retrieves views from the Adapters as scrolled by user.
A table layout is a layout manager and does not do scrolling if required.this means u have to put it inside a scroll view. This implies that all of the data you are displaying must be populated into the TableLayout up-front, so the ScrollView knows the total space it is to scroll in. It also does not directly give you per-"item" selection or interaction, because a TableLayout doesn't have items, it is just a layout manager.
Also Adapter -based view should be used where significant amount of data is there to be scrolled. So it seems that grid view would be more suitable in the situation u r working.