android - How to animate views? -


i'm working on game in ways similar tetris (imagine 2d array of colored squares move around)

i trying animate individual squares smoothly slide down coordinate next. since wanted use android's built-in tweening feature, animation has apply whole view (rather parts of it). doesn't work me because want of colored squares slide down, , rest of them stay still.

the (theoretical) solution came resolve make 2 views, layered directly on top of each other. top view animating squares when need move, , bottom layer static squares. animation-layer transparent until ready animate something. turn on colored square in animation-layer, tween new location, , turn off when done. in same time span, static-layer turns squares on , off @ right time make whole thing seamless end user.

the proposed solution theory, since haven't been able make work correctly yet. since have been having trouble, wondering if best way solve problem? perhaps there more elegant solution on looking? know of better way?

if want animate single element check out namespace android.view.animation.animation. can use drawable shapes , draw them directly. finally, if want simulation have threading. create timer update canvas based on interval. there other view canvases can use glview canvas.


Comments

Popular posts from this blog

windows - Why does Vista not allow creation of shortcuts to "Programs" on a NonAdmin account? Not supposed to install apps from NonAdmin account? -

c++ - How do I get a multi line tooltip in MFC -

unit testing - How to mock PreferenceManager in Android? -