Shows the android interface structure:
Common interface components:
Textview, listview, and toast.
Interface layout:
LinearLayout: Linear Layout
RelativeLayout: relative Layout
TableLayout: form layout
TabWideget: Switch Tab
AbsoluteLayout: Custom x and y location layout
Game Development
Game Development does not use the above layout method. The game uses a state machine to keep Canvas painting on The view.
You can use Handler or postInvalidate to refresh the view development framework notification interface:
Handler instance:
Handler myHandler = new Handler ()
{
// After receiving the message
Public void handleMessage (Message msg)
{
Switch (msg. what)
{
Case Activity01.REFRESH:
MGameView. invalidate ();
Break;
}
Super. handleMessage (msg );
}
};
Use postInvalidate
Class GameThread implements Runnable
{
Public void run ()
{
While (! Thread. currentThread (). isInterrupted ())
{
Try
{
Thread. sleep (100 );
}
Catch (InterruptedException e)
{
Thread. currentThread (). interrupt ();
}
// Use postInvalidate to directly update the interface in the thread
MGameView. postInvalidate ();
}
}
}
SurfaceView class development framework www.2cto.com
The obvious difference between the SurfaceView class and the view class development framework is that SurfaceView does not need to update the view through threads, but you must use the lockCanvas method to lock the canvas and get the canvas before painting. After painting, you can use the unlockCanvasAndPost method to unlock the canvas and display it on the screen.
Graphics class: paint, canvas, etc.
Full Screen Display: requestWindowFeature (Window. FEATURE_NO_TITLE );
Screen Adaptation: sensor
Tween animation: animated effects are generated by constantly changing images (such as translation and scaling) of objects in a scenario.
Frame Animation: this is an image that can be prepared through sequential broadcasting.
Gif Animation: Gif Decoding-sequential playback
From Tyrone's column