I am making an app in which the 1st layout contains clickable List having 12 items
and on clicking of each item, the user goes to a new Activity that has Expandable list View.
And I have concerned the tutorial at https://www.youtube.com/watch?v=BkazaAeeW1Q
and do I need to make 12 Activities each containing an Expandable View or is it possible that one Activity containing 12 Expandable Views but only one Expandable view is visible at a time (and which among them is visible will be dependent on Item clicked on the List View of 1st layout)
Hope I am able to make my point clear?
Use List Fragment, by using fragment no need to create 12 activity ,you just replace the container with view.
Also we can make one expandable view at one time, check on child click and onGroupexpand method for that.
Related
I’m trying to implement three level list views where only the top level is required to be scrollable. Example of the UI is as below:
List view 1: List of houses : scrollable
List view 2: List of rooms in houses : Not scrollable
List view 3: List of windows in the rooms : Not scrollable
Important thing is that the data I fill up needs to be dynamic. So the number of items in the list view 2 and 3 can be changed.
I don’t want list view 2 and 3 as scrollable as they are not going to have too many items, and I want them to be displayed always. Therefore, only top level list view is required to be scrollable.
I tried with 3 level expandable list views but I really don’t need expandable list views as they increase the number of clicks to view all the information at one time.
I tried is to add ListView within ListView and adding adapter to add items in the low level list views. But its not working. It displays only top level list view but the child list view is not displayed at all.
Is there any way to add ListView within ListView as above?
If there is not much item in listview 2 & 3 then do not use listview for level 2,3.
Use a listview for 1, LinearLayout for 2 & 3 and add textView dynamically to those layouts.
Put 2,3 layout to another linear layout and align it to bottom ... so remaining place above those view will be covered by listview.
Comment if my answer is not clear or you need more explanation.
I have ListView which has many items(rows), onClick of any item goes to the DetailActivity which explains more about that particular item. If I want to see the detail of the next item, I have to come back to the ListView and click next item. How to design to see the next or previous item's detail from DetailActivity by swiping it left or right.
I assume that you have a Custom Object and ArrayList of this object.
You need to have an adapter to Show this Arraylist into Listview
When you clicked the list item you need to pass your object from ListActivity to your DetailActivity
I think you are doing this fine until this part.
Then now, you can use ViewPager and its adapter in your DetailActivity.
When you click the list item, you need to pass your Arraylist and your object index to the DetailActivity.
In the DetailActivity, get your Arraylist, set your List into ViewPager adapter, find your object via index(that you clicked) and set ViewPager page index as your wanted item index.
If you manage this correctly, you can slide details of your content. You can ask ma anything to make this clear.
There is a tutorial of Using the ViewPager: http://architects.dzone.com/articles/android-tutorial-using
You could go with a ExpandableListView. No need to open a new screen or doing something which becomes hard to manage like Fragments. The user can show/hide detail just by clicking on the item.
A view that shows items in a vertically scrolling two-level list. This
differs from the ListView by allowing two levels: groups which can
individually be expanded to show its children. The items come from the
ExpandableListAdapter associated with this view.
I have 2 Button and one ExpandableListView in my activity.On button click i need to get Child views which is expanded in expandable List view. In other way i need to get all the child views which is currently showing in expandable List. For your reference i have added some sample image. in that i have get count button. on click of getcount button i need to get which is expanded(Dell) and its child and that count also.
I would recommend you do not add extra buttons. Without code it is hard to give you an example of what to change in your code.
However, I would suggest you take a look at ExpandableListView#OnChildClickListener. The method should offer the functionality you are looking for. I quote the documentation:
Parameters
parent The ExpandableListView where the click happened
v The view within the expandable list/ListView that was
clicked
groupPosition The group position that contains the child that was
clicked
childPosition The child position within the group
id The row id of the child that was clicked
This should be sufficient to serve your needs!
I am looking to create an application where some items are showcased. Currently they are being shown in a list with title, subtitle, icon and some information. I am thinking of implementing a layout switcher here, which will enable to user to change this view to lets say icon view where they may be displayed as a grid of 3 columns. Also this switching can be animated if possible. There will be two buttons over the view, one representing list view and other icon. Clicking on any will show up the respective view. Any idea how to do that??
for list
gridview.setNumColumns(1);
and for grid
gridview.setNumColumns(2);
You can switch the view shown in activity using setContentView() method you can call setcontentview in onClick callback.so that whole you can switch between gridview and listview.
Cheers....
I want to design my app. with more modularity. In my app most of the screens are ListViews, and with similar list items.
For eg. I have 3 ListViews, each for a different category. (Music list, Audi list, Video list) and 1 Main view, that list latest 2 list items of each category.
My Plan is to reuse the 3 inner ListViews on my Main view as as list items.
If you want to have a multi-list view (each item having or not a subitem), you can use an ExpandableListView.
I am not completely sure if that's possible but the first thing I would try is an ExpandableList.
Check this so question:
How to add image in expandable List in parent in android?