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.
Related
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
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.
I am working on an android app and I have to Implement the below screen. That screen has two buttons at the top just like we have in tab view, on changing the button 1 is for opening the Picture view and other is to view the videos screen. Below that buttons I have to Implement two listviews for video screen that will each contain one header like one for songs (below that will be a listview of songs) and second header is for films (below that will be a listview of films). And the data for both songs and films is coming from two different services, just like for songs http://mywebsite.com/songs and for films http://mywebsite.com/films. Now I am little bit confused about the UI that there are many alternatives to implement it, but not sure which one will be best for me.
Please give me some ideas about how to implement it. Should I use a Radio group for the above buttons and on State change it should call the respective method, for a view of video and picture. But for each view I will have to make two listviews , just like in the video screen one for songs and other for films. And making two listviews is little bit complex than a single listview. Is there any way to handle it by only one adapter and in that view the same headers should be there. Ad if someone has any good idea then please share it. Any help will be highly appreciated.
You should consider to use fragments for your tab functionslity.
An alternative for two list views could be one expendablelistview. With two groups. You can add multiple types of items to any list view. You just have to overwrite the getitemtype Methode and define the different types you want to display in your listview.
1) hey bro, firstly u hv to create a swap view with a navigation tab functionality on it. check out this link http://developer.android.com/training/implementing-navigation/lateral.html
2) the above example will provide you 2 fragment pages that you can use for picture and videos separately. You can create the layout of every page as you like via using separate fragment with their own layout as you wish.
3) Now in video layout fragment, you can use 2 list views one by one in the linear layout with orientation vertical. Check this link to get idea how to implement your custom list view. http://www.androidhive.info/2012/02/android-custom-listview-with-image-and-text/
4) You have to put the value of Android:weightSum="2" in parent layout( linear layout with orientation vertical) and put Android:layout_height="0dp" & Android:layout_weight="1" in each list view. This will provide equal space for both the list view in single screen for each type of device.
I implemented alphabetical section headers in my ListView by adding an additional TextView element in my ListView row layout and using this additional TextView element as the header by toggling it's setVisibility property when necessary in my custom CursorAdapter. So my row layout hierarchy consists of 2 TextView's inside a vertical LinearLayout.
I want the section headers to be independent of the row element it's contained in.
Originally, clicking on the header would perform the action of the row element it's contained in, so for example if my list consisted of the elements 'Apple' 'Apricot' and 'Avocado', clicking on the header, which is labeled as 'A' would perform whatever action of the row it's attached to, which in this example would be 'Apple'. I managed to prevent this from happening by setting the TextView representing the header as clickable.
However, I am still stuck with an annoying visual effect where when I click on 'Apple', the highlighting showing my selection on click highlights the entire row, so both TextView's are highlighted. Here is an example showing what I mean. In this example, when I click 'Daft Punk', the attached header 'D' is also highlighted. Is there anyway to set it so that only the second TextView is highlighted?
That isn't supported in a non-hacky way. If you want to properly implement a listview with sections, there's a plethora of examples using the supported multiple view types strategy.
Here are two questions for implementations and libs that do what you want:
Android listview groups
Creating categories in a ListView?
A tutorial to roll your own:
http://w2davids.wordpress.com/android-sectioned-headers-in-listviews/
If you do want to go the hacky route, in the comments for this post, he mentions intercepting touch by exploiting the focus/click event behavior bug.
Cyril Mottier
The main menu of my app should look like this : http://imageshack.us/photo/my-images/31/accueilpart1.jpg/ and after a scroll http://imageshack.us/photo/my-images/38/accueilpart2.jpg/
I'm kind of lost right now because I don't know what is the best way between a listview with clickable sections headers (I think I will have to use different adapter or one custom adapter with test like "if XXX.getClass() == Test.class") or the other option is a linear layout inside a scrollable view where I put each items myself (with an enum type maybe).
Can someone help me ?
Thank's
I have created that sort of look using a ListView and my MergeAdapter.
In your case, it would appear to be an action bar (perhaps using ActionBarSherlock), for the bar with the logo, refresh button, etc., and a ListView holding:
a View for each header (Actualité, etc.)
a single View for the "main article" (Porrentruy)
a series of ListAdapters for the articles inside of each header