gallery with flip action for individual items in android - android

I am trying to Build a gallery in Android ( Not exactly what is already existing in android , by gallery I mean a set of images being displayed together ).
I want to build something like this :
http://www.simpleviewer.net/tiltviewer/app/
(Ignore the 3d affect.. )
A set of images that can be flipped to see the text behind.
The list of images is dynamic and also the content .( I would be getting the list from web )
Also two images could have been flipped on one side and two can be on the other side.
I initially referred 3dTransition : http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/animation/Transition3d.html and understood a little about transitions.
Do I have to create 10's of ImageViews according to list and place it dynamically or do I have a better approach.
Referred : Android + Use ViewFlipper to flip individual items within a ListView?
But the list view can show one item in a row.. I want to show two to three items. Also individual Items must be clickable and not the complete row.
referred http://code.google.com/p/shelves/ , to implement multiple items in a list row. So is that the way to go ?
How do I display text ? Inflate layout as many as Imageview ?
Or one layout file would do ? (How ? ).

Finally implemented it in this way :
A GridView as top layout.
Each child layout having a ViewFlipper with two views . one for image and other for text.
I attached an onlClick event on griditem onChildItemClick
Note : the swype (fling) action wouldn't work in this screen due to problems of detecting a fling gesture in a scrollable view. This might help : http://www.jmstudio.org/archives/391 or can look here too Swipe/Fling tab-changing in conjunction with ScrollView?

Related

How to display one item at a time in a list in an Android Activity

I am new the Android development (3 weeks).
I'd like to create an Activity that allows the user to scroll through a list of items. I'd like only one item to occupy the width/height of the screen at any given time. At the same time, I'd like for the items to be able to scroll smoothly (up/down), similarly to facebook/instagram. During run-time, items will be pushed on top of the stack/list (like a news feed in FB).
What is the best way to accomplish this? What are the pros/cons between using a ListView, LinearLayout (Vertical) items, a List of Buttons added on top of one another? Or should I use Fragments that display on top of one another? How would I implement the ability to display only one item at a given moment?
The answer is to use a ViewPager: http://developer.android.com/reference/android/support/v4/view/ViewPager.html
By default, the motion is horizontal, but there are examples that show how to make it vertical.

Android: ListFragment, how to show only one list item on whole screen

how can I set ListFragment to show each of its items on whole screen? And of course, when you swipe up and down, whole item should be available at a time, the list shouldn't stop scrolling in the middle of two items. Thanks for any suggestions.
You have two choices:
Add a OnScorllListener and implement logic to "settle" the list
after a scroll.
Make a vertical ViewPager. You could copy the source code and flip everything from using X to using Y.

How to add Parallax Effects to List Item in android

I have an listview in my app, which displays list of images only. Now I want to add parallax effect for list items while scrolling the listview. I just now implemented listview only.
In a nutshell, you need to set a header to your ListView. This header will contain the image you want to apply a parallax on as well as the content that should go over (it usually is a classic ListView header but it could as well be something that looks like any element of your list).
The second main thing is to add a ScrollListener to your ListView, and create a custom ImageView (which overrides ImageView) that is able to receive how much your list has scrolled. In the onScroll callback, you can retrieve the first element of the list if it is visible, do a getTop() on it and send it to your custom ImageView.
You now have an ImageView that knows where it is on the screen even when your List scrolls. All you need to know is to translate the Y of your view (with either canvas.translate() or view.translate() depending on which SDK version you're working on).
I don't think it takes much more time than integrating a library and it works great!
I generally use ParallaxListView by Gnod. Check the below link
https://github.com/Gnod/ParallaxListView

Issue with Gallery

I am extending Gallery class & displaying scrollable images in a horizontal manner.
I am displaying only on the landscape mode.
For displaying the images , I am using BaseAdapter , since I need to place text & icon over the images.
I am displaying the no of images based on a condition which is set.
I want to put the following conditions.
i> If the no of image to be displayed is 1 , I'll only show a single image on the middle of the screen & there should not be any scrolling.
ii> If the no of images to be displayed is 2 , then both the images should be shown side by side(horizontal) & without any scrolling.
iii> Only if the no of images is equal to or greater than 3 , then images should be displayed in the horizontal manner & scrollable.
How can I handle all the above cases using a single layout xml & by handling the conditions source code.
Kindly provide me your inputs/sample code.
Thanks in advance.
Warm Regards,
CB
well for showing the text and the image you will need to create a custom adapter override the getView method and a custom layout (a linear layout with vertical orientation containing a textView and an ImageView) inside the getView. You can find a lot of examples of doing that on google, its pretty simple.(there is the gallery example on the android developers page that explains this). Hello Gallery
For your conditions you can probably make something like this in the adapter constructor or the actual creation of the adapter in the activity. i think by default it wont be scrollable for 1 item, but for 2 it will be since the gallery centers the selected item... which is pretty lame. and for 3 or more it will work as intended (show a scrollable horizontal list of items).
Hope this helps.

add the image for each listview item in out of the listview

Hi i want to add the particular image for each listView item left side .but that is not included in the listview ,see the image from below link
Image
I understand you are talking about the image with red circle. This is functionality of Iphone and not available in android by default. You will have to create custom listview and make the image part of the list item. It cannot be outside listview. That way it will be difficult to access it later on.
Take one scrollview in taht scrollview take 2 linearlayouts as horizontal and then assign images to one linear layout as vertical and add listview to another layout
Here is a nice article http://blog.sptechnolab.com/2011/02/01/android/android-custom-listview-items-and-adapters. It works.

Categories

Resources