Android runtime generated tabs and content - android

I am creating an application on Android which is essentially an interactive menu. I will have several categories for this menu, with a list of items in each. These items and item groups are specified when the application is loaded up, and are taken from an SQLite database (although I am not worrying about that bit yet).
Below is my own design which is how I want to the application to look. The top orange bit is the actionbar, and I will use swipe/tabs attached to this. As mentioned all the item groups and items are read from a database, however there could be any number of items, or any number of item groups, so I want both the tab bar and the bottom area of the screen to be scrollable.
The image is slightly cropped to hide some of the titles/logos etc.
My idea so far is to create a ScrollView for each tab, and a TableRow fragment for the grey boxes containing the item_name, price etc. Would it be possible to create an undetermined number of views/pages at runtime, and then fill each of these with the scroll view and then in turn fill each scrollview with the rows of items. Each tab layout will be pretty much identical from the others apart from the actual items it contains. I could either generate all these tabs on creation, or dynamically read the contents of each tab and change the information when a tab is switched, would these be possible?
I'm aiming for API 19, I created a "Tab Activity" but the code auto-generated is slightly different to tutorials I have seen on creating tab screens, they also always work with a pre-determined number of tabs.
Having trouble with this as an Android newb, any help would be appreciated, thanks!

I'm not getting you well but I think you can read your database at atartup and create tabs based on the result.then on each tab fragment create a listview displaying the item_name, price etc. no need to create a ScrollView as a listview is automatically scrollable

Related

Android App UI layout review

Now I’m designing the UI for my first Android Application. I just wanted to confirm if what I grasped and design choice is rightly done.
The requirement is, I need to display a list of Images+Data on the home page, it might run into hundreds. It also contains a search header. + category selection on thetop.
Clicking on the menu button must side the panel of links for Menu/Config.
I learnt, doing nested layouts are closer to evil in Android. So I did not put multiple one into the other. I’ve put a simplified one.
I have shared what I’ve designed for this requirement. Any word of concern/recommendation would be highly appreciated.
SlidingPaneLayout is the root element of MainActivity.
Bottom View contains list of menus
Top view diplays list of Images
Top view has the following elements
Title Layout : which is basically a RelativeLayout, holds Title name, burger icon and search button
Image ListView : displays list of images from local memory
Sub Category Layout : which is again a RelativeLayout. This displays the sub-category of the image displayed in the Image listview. This will change when user scrolls. Taping on this will display a sub-category listview.
Search bar Layout : which is a RelativeLayout. This has a drop down suggestion listview, which displays suggestions.
Key Questions
Should search be put in a separate activity?
Should search be put in a separate View/Fragment?
Is there any way the layouts can be reduced or replaced with better layout?
1-2/ The ListView should be put in a separate fragment and the search should have its own also. The search view fragment should be open on press of the search icon. You have listeners for opening and collapsing the search field. The idea is to change fragment only in the host activity. Each fragment should implement its own logic.
3/ For sure don't use ListView when you are going to have hundres of items. Instead use the RecyclerView that recycles and reuses the views. ListView will be okay for the left drawer menu as its going to implement static number of elements that won't need recycling.

How to create listview and title (dynamically) in Android programmatically?

I am really confused, which among GridView, Tableview or multiple listview to be used to develop a UI as shown in below image.
I don't know how much list data (categories and its sub categories) is in web. It is dynamically added from wed, and sent to my android app.
Please suggest me, what view is best for developing above UI.
Note: I want to make it programmatically.
Thank you in advance for your co-operation.
Keep in mind that the image you have shown as an example is quite large and such an implementation would make for a cluttered UI on smaller screen sizes. That being said, the example you provided could be achieved in Android by using a GridView. Each major category (Automotive, Jobs, etc.) would be a grid item, with the sub element implemented as either a TextView or even a ListView within the grid item. Something like this:
As both #PedroHawk and #bryan mentioned, you could also use an ExpandableListView; in this scenario, the major categories (Automotive, Jobs, etc.) would be header items and the sub elements would be children of the header. Something like this:
However, with this implementation you would be limited to a one-dimensional list - that is you would not be able to have major categories next to each other as shown in your example.
With both of these implementations (ExpandableListView and GridView) you can dynamically add more elements as you receive data.
Like PedroHawk said, ExpandableListView is an option. But also consider because of the screen size, you may not want to try and port the UI directly over. What about a single ListView with just the main categories and the user can drill down?

how to show image grid in a Drawer which has a listview inside it

In continuation with my last question
How can I make a multi-level(more than 3 level) navigation drawer in android?
What's happening: Basically I am showing filters in my navigation drawer which has children up to many levels. Whenever I click on any, it puts the selected filter at the top and shows its children below as a simple list.
What do I want: When I select a filter, I want to see the images of its children in a grid view inside the drawer(which is vertically scroll-able) just below the name of the filter. If an image is selected here, the name of this children gets added in the hierarchy list and I could see image grid of the new children. This could got upto many levels(safe to assume 4-5).
I was thinking I could make a fragment with same colors as that of the drawer and show my grid view inside it. But I lack much knowledge in it, how could I keep the fragment just below my list and inside the drawer.
Kindly provide a detailed solution. Android noob here.

Android - Two column layout

I've a two column layout and want it working like the "Settings" on a android 4 on a tablet.
On the left a menu (it's a ListView) and depending on the action on the list view I want to load an activity on the right column.
How can I achieve this? I'm unsure of what keywords to use to search for a solution.
Sounds like you want fragments. What you would do is create an activity that allows for two fragments which you can customize how you want.

Activity with viewpager at the south part and support api-10?

I'm looking into the possibility of adding a viewpager at the south/ bottom part of the screen of my activity that is supposed to hold a part of a limited list since I've run into a problem with performance.
The list of items are clickable. I make some fields visible and the list gets pushed down when an item is clicked for the information to be visible of that item.
I need to support api-10.
I've looked at actionbarsherlock and to me it does not seem possible to add that to the south part of an activity.
Any suggestions?

Categories

Resources