Android :: Animating View Position?
Feb 3, 2010
I'm trying to do something which seems simple. I want to have a map view, with a menu that slides up from the bottom of the screen where settings (for overlay) can be adjusted. However when I use a TranslateAnimation to affect the y position of the LinearLayout (which holds the menu), the buttons in the LinearLayout move, but there "hit area" stays in the same position as they were before the animation.
CODE:.........
I've also looked into tweening the view's marginTop value, but haven't even been able to determine how that would be done.
View 1 Replies
May 18, 2010
I have a HorizontalScrollView with a series of CompoundButtons. I want to find the (x,y) for a given child view. I have tried using:
getLocationOnScreen()
getLocalVisibleRect()
getChildVisibleRect()
like this:
View tmpView = this.findViewById(viewId);
Rect hitRect = new Rect();
tmpView.getLocalVisibleRect(hitRect);
the hitRect is always 0,0 - 0,0.
I need the x,y mainly to scroll to a particular child view. Any help is greatly appreciated.
View 1 Replies
View Related
Jan 8, 2010
Can anyone give me a tip for how to get the position of a view what is a child of an AbsoluteLayout? I want to do this for drag and drop the selected view.
View 2 Replies
View Related
Sep 1, 2010
Can I get a View's x/y position (relative to the root layout of my Activity) in Android?
View 2 Replies
View Related
Jul 27, 2010
I currently have a view in my Android app and the view is playing a frame animation. I want to animate the view to increase its size to 150%. When I apply a scale animation to it, and the scale animation is completed, I want the view to stay at that new size for the rest of the activities life cycle. Unfortunately right now when the scale up animation is complete, the view snaps back to the original size. How can I get it to keep the new animated tranformation? I'm using myView.startAnimation(AnimationUtils.loadAnimation(mContext,R.anim.scaleUp150));
View 3 Replies
View Related
Nov 20, 2010
I try t get the position of the item who contains my button.How Can I pass the position variable present in the getView method to my onClick Method?I will have several button In my View (Item view)
View 1 Replies
View Related
Feb 7, 2010
I have a GridView, using a custom adapter (myAdapter extends BaseAdapter), where each item in the grid holds an ImageButton. getView() is working fine.
However, from elsewhere in my code, how can I update the image (setImageResource) for one particular item in the grid based on its position in the GridView?
So far, I've added this to my adapter class:
CODE:........
And would like to write something like this: mygridview.getItemIdAtPosition(20).changeImage(); (doesn't compile).
View 2 Replies
View Related
Aug 26, 2010
I have a horizontal scrollview with text fields,here i need to get the first and last position of textview when i scrolled it,how can i get the position of textview when i scrolled.and also need to know how to set color for text when i clicked the particular text from this. sample code....
View 1 Replies
View Related
Aug 19, 2010
My friend and i develop a Android program.
Now we got to the question if it's possible to get the actual position of an ListElement.
Example: You drag the list up and down, and now you want to konw which element is on the center of the screen?
View 2 Replies
View Related
Jul 20, 2010
Is it possible to set the absolute position of a view in android? (I know that there is an AbsoluteLayout, but it's deprecated...)
Lets say I have a screen 240x320px, and I want to put an ImageView which is 20x20px with its center at the position (100,100).
What do I have to do?
View 1 Replies
View Related
Aug 9, 2010
If you use an AbsoluteLayout (I know that it is deprecated, but it was the only way to solve my problem ) you can give the childViews the tag "android:layout_x" and "android:layout_y" to set their absolute position within the AbsoluteLayout.
However I dont want to set these informationen in the xml, because I only know them at runtime. So how can I set these parameters at runtime programmatically? I dont see any method on the View like view.setLayoutX(int x) or something.
Here is my XML, which works fine, when I set the layout_x and layout_y values. code...
View 1 Replies
View Related
Apr 5, 2010
I have a custom component which consists of 2 text view and 4 toggle buttons. I want to draw this view at some specific position on the screen. How is that possible?
View 1 Replies
View Related
Jul 12, 2010
Sample code there is a method getitem(position) in the class of image adapter which returns null for the sample example. However, this method is important and is supposed to return the corresponding data item of the image adapter. For example the image adapter could generate a series of customized image views by magically calling the getview method. How could we implement the getitem(position) method under this case to help us gain access to these customized image views?
View 2 Replies
View Related
Jun 16, 2009
I have a custom view that I had to write for a large scrollable image, as the images are larger than the size of the screen. Before, I had tried to do it by putting the image into a ScrollView but that of course didn't work. The view itself is within a RelativeLayout within the activity and at the bottom of the screen I have two buttons that are used for navigation and at the top a TextView with a caption for the activity (the main header is already being used here for instruction). In my below code, I've checked the Hierachy Viewer to confirm all the elements are loaded and in the Activity I can see the TextView, however it overlays the ZN5ScrollView area and below the image I just have a blank area of the size defined rather than my buttons. For the bottom navigation, the Hierachy Viewer is saying the absolute_y of the bottom navigation is 480. I'm wondering if anyone can help with my layout code here to get this working correctly? Bottom navigation is 50px high, ZN5ScrollView is 365px above the navigation, and the TextView takes up the rest of the area at the top
View 4 Replies
View Related
Feb 6, 2009
I'm trying to set the selection of a Gallery in code. I would like to have the Gallery smoothly roll down a few items over the duration of a second or two. At frist glance, it appears that two members would to the trick:Gallery.setAnimationDuration(int animationDurationMillis); Gallery.setSelection(int position, boolean animate); It turns out that the setAnimationDuration only seems to affect the rubber-bandy "return-to-center" effect of the Gallery. In other words, when a gallery comes to rest after a fling, and a gallery item is off center, the animationDurationMillis is used to control the duration of the Gallery centering up the item. However, the value seems to have no effect on the setSelection. No matter what value is set with setAnimationDuration, the Gallery seems to render about 2 or 3 frames when flying between items 1 and 10 for example. Is this working as designed? Does anyone know a trick or workaround that would let me properly animate setSelection? I'd be especially grateful if we could do it with an "Ease Out" effect.
View 3 Replies
View Related
Sep 29, 2010
On my htc i was looking through display, i see g sensor calibration and i perform this calibration and after i do so the screen seems to have a delay when switch from the horizontal position to the vertical position. its weird because when i switch to the phone horizontally it switch normally and responds fast. but when i switch back to vertically it takes almost 7 seconds to actually switch back, sometimes it switch within 2 or 3 secs but never as quick as switching horizontally.
MQuote:
Originally Posted by Rigmaster
Make sure you have the latest updates, which impact speed on the device in some unpredictable and unexpected ways. During system updates, your Evo may reboot and will take the g-sensor changes as last calibrated.
If you're already updated, shut down and repower (soft reboot) should do the trick. I actually updated my phone and after it started to do this. I restarted the phone plenty of times i even took the battery out for 30 seconds. It only does it when im texting on the browser, basically everything but the camera. He camera screen rotation is perfect. I even rooted the phone but i havent figured out how to use the root to fix the problem. Should i do a firmware update? Because i just did the htc software update.
View 1 Replies
View Related
Sep 17, 2010
Is it possible to animate the expanding and collapsing of the groups in a ExpandableListView.
View 3 Replies
View Related
Apr 8, 2009
How do I animate a Layout?
I have a RelativeLayout which sits in a certain position within my Activity; I want to glide it in and out from the bottom of the screen when a certain button is pressed.
I have found examples of animating the children of lists etc but this is not what I want. I simply want to animate the whole layout and the views within it together.
View 4 Replies
View Related
Jun 22, 2010
I have tried a weather widget and its working fine. The Weather widget is an app widget and I update the widget once in 6 hrs similar to the application on android site using AlarmManager. Now I want to animate the widget (ImageView) every 100 ms similar to HTC homescreen.
I dont think AppWidgets will scale well for this case. How can I implement this widget?
I have seen "Custom Homescreens" in previous Android SDK's. Should I have modify the Homescreen widget for doing this or is there any other way.
View 4 Replies
View Related
Aug 26, 2010
I'm drawing a ProgressBar in a custom View (SurfaceView) to it's Canvas, and it's drawn as expected. Except that it's not animating, no matter what I do. My custom view is animated properly, but I cant change the progress of the ProgressBar.
I've created the ProgressBar like this:
CODE:..................
And I draw it something like this (slightly simplified):
CODE:........
And I've tried updating it's progress manually as well:
CODE:.................
Any ideas on what I need to do in order for my ProgressBar to animate or change it's progress.
View 2 Replies
View Related
Nov 5, 2010
This is more of a question about animating than a specific problem coding. i need to fill in the broad strokes left by the research i've been doing.
What i'm trying to do:
The activity should load with only the a togglebutton visible. when the button is touched, a png will be animated to a certain position relative to the togglebutton. also, another button will slide in from off screen and slide off if/when the togglebutton is pressed again.
What i can't figure out:
I can draw an image, but only via xml. creating an imageview and setting the background programmatically does nothing.
When i draw from xml, i can't move the image when the togglebutton is pressed like i want to. when i call getPositionOnScreen() i get a null pointer, even though the complier can see i'm referring to the imageview described in both xml and in code.
I'm calling getPositionOnScreen because via xml, i have the image positioned behind the togglebutton so that it's not visible until the button has been pressed and the image starts moving. the idea is that with different screen sizes i won't know exactly where the view is until runtime. getPostionOnScreen allows me to get the coordinates of the imageview so i know where it has been positioned. when i have a start position, can tell it to "move up" on the screen from behind the togglebutton by simply adding to x or y until it's where i want.
This is the code to draw the image (inserted in the onCreate method).
CODE:.......
This is the code i'm using to animate. when the button is clicked, it calls this method on the view from the listener.
CODE:...............
I'm well aware that this is horribly wrong and won't work. what i need to understand is why.
View 1 Replies
View Related
Oct 6, 2010
I have a RelativeLayout with a tiled background. Is there a way to make a tween animation to fade out the existing image and fade in a new one?
View 1 Replies
View Related
May 19, 2009
I am using a SurfaceView, and wish to animate Drawables. All the animation tutorials I have seen concern using an ImageView, which as I understand is not a sensible approach from within a SurfaceView. Does anyone have any suggestions for doing frame-by-frame animation within a SurfaceView? Can it be done with openGL?
View 4 Replies
View Related
Apr 27, 2010
Is there a way of being notified when a TransitionDrawable has finished its transition? I'm looking for a way to animate the background of a LinearLayout, switching it back and forth between two images thus creating a pulsating effect. TransitionDrawable works nicely, but....once. I tried stacking several 'item' in the XML defining the transition, but no luck. It justs fades from item 1 to item 2 and sits there. I'm wondering if I shouldn't implement a custom Animation.
View 3 Replies
View Related
Nov 10, 2010
Does anyone knows if it's possible to animate different views during the same animation: I have a linear layout containing 6 dices (each dice extends a textview) and I need to animate each dice to simulate a roll (each dice will rotate on itself). I know how to do this rotation on each dice by using 6 animations, but I want to group these animations in one, so that I would be able to add an animation listener to execute further instructions at the end of this animation. I tried with an animationset but didn't manage to do it.
View 2 Replies
View Related
Sep 29, 2010
I create a ProgressDialog in onCreateDialog() like so:
code:.........
Android, in its wisdom (or serious lack of it) decides to cache every dialog created through onCreateDialog(). Because of that, any subsequent call to showDialog(DIALOG_PROGRESS_ID) results in the same ProgressDialog instance being used but the animation has stopped working.
I've tried to re-set indeterminate in onPrepareDialog(), but that doesn't do anything. There is likewise no obvious method to call on the dialog instance that will reset the animation.
code:................
But maybe there is a way to get the ProgressBar itself and start it animating? so I tried the following after I asked this question:
code:........
But it didn't work either!
So, does anyone know if there is a way to restart animation on a ProgressDialog? If not, is there a way that I can force every showDialog() call to call onCreateDialog()? (this second question was answered by @TuomasR, but after pondering it I don't think this is a very good solution to my problem)
View 1 Replies
View Related
Sep 2, 2010
Is there a way to animate drawables on a canvas using the android built-in animation classes?
Ive been modeling my test application, a game, after the example apps lunarlander and jetboy. They contain a lot of reusable code, but they manually update the drawable objects in real time. It seems like using the android animation built ins would be so much easier since they provide the type of animation I need¦a simple linear movement.
Is there a way to do this, or am I better off updating my canvas in real time much like the example apps.
If there is a way, could anyone get me started with some sample code? I am currently inheriting SurfaceView in my class.
View 1 Replies
View Related
Sep 20, 2010
I am using android.hardware.Camera to get a preview and display it on a custom SurfaceView that implements SurfaceHolder.Callback.
I am trying to zoom in to the camera preview surface by a specified scale (not using the camera's digital zoom) but I can't seem to find a correct way to do it. I also need to be able to zoom out and scale down the preview.
I was hoping to be able to do this using a ScaleAnimation but it doesn't seem to work on SurfaceView, nor the FrameLayout containing the SurfaceView.
I also tried setting the size of the SurfaceView using setLayoutParams but that doesn't seem to work too well on various hardware and it would be tough to animate smoothly.
How to achieve this effect? Right now I am starting to think I might have to implement this using GLSurfaceView but I'm very unsure.
View 2 Replies
View Related
Nov 22, 2010
I have an app that is working fine in 1.6 and up but crashing for apparently no reason in 1.5. The app suddenly quits with the following message...
CODE:............
This error happens when the app is 'idling' (ie not doing anything other than redrawing the screen). There is no state change and no user input. The error occurs after the same amount of elapsed time whatever I set the frame rate of the app to and occurs both on the emulator and device. Changing what I display on screen can stop the error but there appears to be no logic to this (in one instance not drawing a large image stops the error but elsewhere just drawing some text causes the app to crash in the same manner).
I am using SurfaceView for animations following the basic procedure in the Lunar Lander sample app.
View 6 Replies
View Related
Jan 22, 2012
I got to make a really nice menu, with all buttons working...but when I got to the part of creating a character and making it move, I just couldn't find info anywhere.
how to create a character, and to make it move left/right when I press some kind of button? ( and how to make that special button too)
View 7 Replies
View Related