Listview zoom and animation in Android - android

Hello Please help me with an Issue, I have a gallery to which i had applied animation. What is actually does it zoom the current/clicked view.
I want that same behaviour in my listview, for example i have
PLAY
SETTINGS
QUIT
So when i click PLAY it should have a zoom effect PLAY
Please guide me..

The view that you are trying to implement can be done with gallaryview in android. So if you can modify gallery then you can get this behaviour, if it seems tough that just grab the opensource coverflow code and modify it a bit to get desired behaviour

you can have an integer variable to hold, currently focused element in list, and in your adapter's getView method, check this variable with position and on match can return a different view, on focus change, reset position holder value, and call adapter.notifyDataSetInvalidated();

Related

embed the string in view flipper ontouch

I am creating an application in which i have used four custom view.I have embed that in the viewflipper now i want to add ontouch event to viewflipper.i have added the ontouchevent but i want that when user touch on the particular position then it will show some text on the canvas which is used by viewflipper.
I have uploaded the image also can any one help me on this topic .
Use a text View in your ViewFlipper and set its visibility to View.Gone orView.Invisible
when click on your particular zone call
myTextView.setText("your text");
myTextView.setVisibility(View.Visible);
hope that idea will help you
I have mention in my question that i am using view.so i have used the invalidate method .
Viewflipper .invalidate ();
invalidate method force to redraw the view if you want more knowledge then refer this link

Android Gallery View and adapter getView gets called many time

I have a Gallery, which has an adapter connects to it. In the getView method, i have a custom layout, so that I can i have image and caption displayed together
The image is downloaded from an URL, which is done asynchously, and working as expected.
Currently i make each item to fill the screen, so i only have one item display at a time, basically i want to make it like a slide show.
let me be clear, currently i have an activity, and it only has one View, which is a Gallery.
problem occurs when I am swiping, the image bounces and stays at the same image. i need to swipe many times, hard, and long swipe, then i can get to next image.
i put a debug message in my custom adapter in the getView(), it seems getView is getting called many times (4 times), and position being passed is either the current position or the previous one, which explains why i am stuck at the same screen.
if i remove the remote downloading image part, or just use a static image form the phone, i don't have any more issues, in fact, the getView only gets called once, with correct position.
i am very frustrated, not sure what the problem is, could it be because i am downloading image asynchously, which will cause the image to update which causes getView to get called again to redraw itself?
i am not sure..
please help
Unfortunately this is a bug with gallery. Listviews will scroll nicely regardless of data being updated asynchronously. However, the gallery is just not coded up to par with the listview
When the gallery tries to update a visible view (due to your image loading callback) this view will "snap" back to the focused position. If you are changing the view in any way when it is scrolling it will snap. This is likely why you have to scroll hard to get away from the current view. It is trying to perform a callback on your view and only scrolling fast will prevent the callback from occurring before you move away from that view.
I've reported this bug a while ago here:
Android Issues
There are a few workarounds posted in there you can try if you are set on using a Gallery.
Unfortunately it hasn't gained attention from the Android developers.
It seems the issue is caused with views being set to "wrap_content" and the gallery having to remeasure/redraw its views
I have since migrated away from using the gallery and instead use a ViewPager. It is much easier to manage and you don't have to worry about this problem. This has been a known problem with the Gallery since the gallery was first introduced. I have no idea if this was fixed in any of the newer Android versions (3.x/4.x). As of 2.3.7 it is not fixed.
At first you should note: Any AdapterView (Gallery, ListView etc) doesn't guarantee that each time getView() method is called it will pass the same View instance parameter. It only guarantees that each view will have the same type (see Adapter.getIntemViewType() method docs)
So, when you start image downloading you should only specify position of the element. Then after the image has been downloaded you should bind specified ImageView with downloaded image in Adapter.getView() method call.
Take a look to the ImageDownloader from the Android samples here
The other approach is to use WeakHashMap in order to contain map of adapter views to its positions. I can provide you with code samples if you need.

Actions on gallery view android

i have two gallery views in my single UI screen or you may say activity, i want to have listener in such a way that on scroll of one gallery view the other should also scroll , i tried giving listener to one gallery and calling the other one gallery view into that ., but its working for me , pls can any one help me..
thanks in advance
Datta
You could try to find the position of one of the galleries with Gallery.setOnItemSelectedListener() and then update the other gallery with Gallery.setSelection().
I believe the Gallery view is missing a lot of functionality (or is broken) as compared to ListView or GridView. In this particular instance, you need a "setOnCenteredItemChangedListener" or something like that. However, the documentation does not show anything close to this.
One option would be to implement your own Gallery class using HorizontalScrollView.
Another (hacky) option would be to rely on your Gallery adapter to push the current position being fetched (which may NOT be the one displayed in the middle) and use that to guess the currently selected position.
You have to override the scroll event of your first gallery and inside this method you should call the onScroll event of your second gallery like this,
gallery_two.onScroll(MotionEvent e1,MotionEvent e2,x,y);

smoothscroll view positioning in android

i am using a list view in which i want to directly shift to particular position when i run my code. i m using listview.smoothScrollToPosition(22) which will show the scrolling effect.. which i do not want to show. i want to directly display 22 position of list view.
i used other methods like listview.setselection(), listview.scrollTo() which doesnt work??
Kindly, help me out
Thank you
setSelection is what I use in a public domain app I develop. You can read the code here. It scrolls the ListView to the position I specify.
Perhaps you could post your code if this method isn't working for you?

Android How to know if a Gallery is scrolling?

I have a gallery and when a image is selected, I want to start new thread (for loading other images). But I don't want to do it while the gallery is scrolling. How can I know the state of the gallery and if it is still scrolling?
I can't use "setCallbackDuringFling(false)" because I have a textview under the image that has to be updated during the scrolling...
Thanks!
Marc
I think you could have a go with setCallbackDuringFling method. From what I understand, if you set it to false, it shouldnt be possible to select an item while fling is being computed.
Use a Handler that is called from the onItemSelectedListener that updates the last time that an item was selected (every time the foremost item changes this listener is fired) and use a timeout value to determine when scrolling ended to determine if scrolling is still occurring.
However, I have the exact same thing in andAMP... I have a FrameLayout with a Gallery and 2 textviews to show the foremost selected Artist and Album... I use onItemSelectedListener to update those TextViews and it works fine. If you have the TextViews in a FrameLayout like me you have to use bringChildToFront to get them to show over the Gallery (add the Gallery last).
As far as Lazy Loading (which I am assuming that is what you are doing). There are a couple of great tutorials about how to do this.
http://ballardhack.wordpress.com/2010/04/05/loading-remote-images-in-a-listview-on-android/
http://android-developers.blogspot.com/2010/07/multithreading-for-performance.html

Categories

Resources