How to create icon view to list view and vice versa switching mechanism in android - android

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....

Related

Android List item click horizontal menu

The attached UI is the calllog. What i am interested is that how the horizontal menu is implemented. When click on one list item, it appeared in one line under the list item.
In the earlier android, one click on list item, we can use Context menu popup menu to show the available action to do.
I am curious that it is using expandable list view concept?
I want to design like that when click on list item to show like this, but my layout would not be the same as this one. I want to put custom layout depending on the list item type. It may include button, textview, other widgets and the layout height will not be the list item height.
Can someone give some suggestion? Thanks a lot.

How to get the view in a custom list view at a specific position? Android?

Let me explain this--
For example - I have a custom list view set up that shows 3 text fields in a group.. I.e. each click able item in that list view will have 3 texts.. so now I want to get the 2nd text view at the 5th index of that listview...How to achieve this?
If a have a basic listview with only one item at each index, then this can be achieved by using getItemAtPosition().
Is this similar in the above case also?
You don't. THe entire point of a listview is that it DOESNT create views for every element in the list- only the ones on screen. So if your list is more than trivially long, it probably doesn't have a view for that item. If you think you need this, you're probably architecting your code wrong for a listview.

Particular Expandable View visible at one time

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.

Android swap two itemViews in a ListView

What is the best way (Compatible with API 8+) to swap two item's views in a ListView?
I've got a ListView and two custom item view's XML, normally the ListView is preloaded with
normalItemView
but when i long-click the item it must change view to become a:
longClickedItemView
when the user release his finger from the screen, it must return to a
normalItemView
I've already implemented the code to detect the user actions of long click and release (See Android ListView running an event on Item Long Click Release) but i don't know how to replace the entire item's view and change it with another view.
Questions are:
What's the best and cross-version way to do this?
Could it be possible to animate this swap?
You must use a viewgroup as an item of the listview and insert your layout into. So, when you implement 'delete', take the reference of viewgroup to remove the layout and then add the new view. About animation, you can use the Google's standard that you find here.

Menu Navigation using ViewFlipper in android?

i have one listview contain menu based on the selected item in listview i want to display new view(add or edit or delete) that is defferent add.xml or edit.xml or delete.xml file.I want to show below like this.Also how to back in to main menu from child view.
i tried using tag using ViewFlipper.showNext() but it display only add view all the time.
Thanks in advance..
You are using different xml. Then why can't you set this as different intent, so it will be easy to navigate.
Anyway viewFlipper.showNext() will only show the next child
You can use viewflipper.setDisplayedChild(whichChild) to get the desired child

Categories

Resources