ScaleAnimation problem

by ellipsoidmob...@googlemail.com » Wed, 15 Apr 2009 03:48:23 GMT


Sponsored Links
 Hi

I have an application which is based on the AnimateDrawables sample,
but which uses ScaleAnimation rather than TranslateAnimation

The problem I have is that my image scales in the way I expect - but
it also moves! For example, if my image starts half way down the
screen on the left and I use an animation such as:

an = ScaleAnimation(1,2,1,2);

then the image doubles in size during the animation, but it also moves
to the right and down to near the bottom of the screen.

I've tried playing with the pivot values (setting them to 0, or to the
middle of the image, or to half of the image width and height) but I
get the same result.

Any ideas???
--~--~---------~--~----~------------~-------~--~----~



ScaleAnimation problem

by vincebodi » Thu, 30 Apr 2009 02:05:58 GMT


 I had the same problem and now it is fixed with this line.
scale = new ScaleAnimation(1, 2, 1, 2,
ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
                ScaleAnimation.RELATIVE_TO_SELF, 0.5f);

On 14 avr, 21:48, "ellipsoidmob...@googlemail.com"



--~--~---------~--~----~------------~-------~--~----~


Sponsored Links


Other Threads

1. disabling scrolbar in ListView

Hi all,

           anybody can tell me how to disable or remove the scrollbar
property of a ListView.

           I created a ListView like

          1)  ListView  listview = new listView(context);

          and i add an adapter in to the list

           2) listview .setAdapter(listAdapter);   //listAdapter is an
adapter

            here the list adapter size greater than one then scrollbar
automatically come,but i want to display the
            contents with out scrollbar .

             Anybody can help me to fix this problem






--~--~---------~--~----~------------~-------~--~----~

2. ImageMatrix has no effect when ImageView is in matrix scaling mode

I have an extension to ImageView that I would like to draw by manually
altering the ImageMatrix.  When I set the View's scaling type to
matrix however, changing the matrix has no effect on the image.  If I
put it into a different mode, say center, changing the matrix does
change the display, but in some the matrix gets reset to the proper
value for center rather than what I want it to be, so I can't really
use a different mode as a workaround.  Here's the code that changes
the matrix (the view implements OnGestureListener

public boolean onDown(MotionEvent e) {
                Log.v(TAG, "onDown");

                Matrix m = getImageMatrix();
                Log.v(TAG, "Initial matrix: " + m.toString());

                m.postScale(2.0f, 2.0f);
                setImageMatrix(m);
                Log.v(TAG, "New matrix: " + getImageMatrix().toString());

                invalidate();

                return true;
}

Here is what the log shows

V/Gesture-Enabled Image View( 3110): onDown
V/Gesture-Enabled Image View( 3110): Initial matrix: Matrix{[1.0, 0.0,
0.0][0.0, 1.0, 0.0][0.0, 0.0, 1.0]}
V/Gesture-Enabled Image View( 3110): New matrix: Matrix{[2.0, 0.0, 0.0]
[0.0, 2.0, 0.0][0.0, 0.0, 1.0]}
V/Gesture-Enabled Image View( 3110): onSingleTapUp

The display remains unchanged, though.  How can I get the image to
change with the matrix?
--~--~---------~--~----~------------~-------~--~----~

3. how to show big images with full resolution

4. Create Bitmap with all Changes on a DrawableBitmap

5. help with onChildClickListener!!

6. Porting 1.0 to 1.5, getSystemService(SENSOR_SERVICE)

7. ScrollView Dynamically Adding Text to TextView...