Animate *actual* position of a View

by Lance Fetters » Mon, 16 Nov 2009 12:47:20 GMT


Sponsored Links
 I am attempting to port a simple "tap the moving target" iPhone game
to Android (1.6). The game animates the position of a button, moving
it to random locations, while the user tries to tap it.

With the iPhone, moving the button is rather simple:

  [UIView beginAnimations:nil context:nil];
  button.center = CGPointMake(x, y);
  [UIView commitAnimations];


I have attempted to duplicate this on Android using Animation/
TranslateAnimation, but have found that this only affects where the
image of the button appears, not the tap boundaries. In other words,
even though the button appears to be moving, it is not possible to tap
it.

Is there a way to animate the actual position of a View in Android? If
not, does anyone have any suggestions on the "Android-way" of making
such a game?

--



Other Threads

1. habis root spica,internal memmory jadi 0.M

Dear all, mohon bantuan nya. Semalem selesai proses ngeroot spica
ngikutin panduan bro mboikser dari blog nya, eh gak bisa install
aplikasi apapun, error nya storage full pas di cek via option bener
internal storage 0MB padahal gak Ada aplikasi apapun. Sekarang setiap
posisi power off semua setingan ilang, browsing juga selalu muncul
pesen storage full... please advice dari suburb sekalian...


Salam,

Imam maulana

-- 
"Indonesian Android Community [id-android]" 

2. Preload NinePatchs

Hi people !

I'm trying to use 9-patches in my application.

At first, I created one NinePatchDrawable that I used in every Button,
but this lead to some problems :
http://pastebin.com/pBep1NM0

This happened with any Drawable, including NinePatchDrawable or
BitmapDrawable.

Someone told me that it was because Drawable was storing some shared
values, so I decided to use one Drawable per button...

But since I was going to use many NinePatchDrawable with the same
NinePatch, I thought it might be a better idea to first create a
NinePatch, and then distribute NinePatchDrawable based on this
NinePatch.

But the NinePatchDrawable(Resouce, NinePatch) constructor produces a
null-pointer exception because no padding is entered... (By the way,
why is this constructor public then ?... Since it directly calls
setNinePatchState, wich calls computeBitmapSize, where the error
occurs...).

So what's the way to do it ? Directly call
Resource.getDrawable() ?... :-/ But then it gets more difficult to
control when the data is loaded... (When calling multiple times
Resource.getDrawable() with the same file, only the first call loads
the file, right ? The others are faster ?)

What is the clean way to use Managers to handle this ?...

Thanks  :)

-- 

3. Application throws exception when I rotate the device

4. what hardware platform do you use?

5. Problems with audio playback on froyo

6. Review tahap 1 HTC EVO 4G: Perangkat keras dan Fitur

7. tanya dimana bisa beli google nexus one yang resmi